Lecture 1: Advance Operating System PDF
Document Details
Uploaded by LovelyCarnelian9264
Dr. Akram Alhammadi
Tags
Summary
This lecture introduces the concepts of advance operating systems, covering operating system goals and computer system architecture. It is a presentation or lecture on computer science fundamentals.
Full Transcript
Advance Operating System Edited by Dr. Akram Alhammadi Chapter 1: Introduction What Operating Systems Do ماذا تفعل أنظمة التشغيل Computer System Organization تنظيم نظام الحاسوب...
Advance Operating System Edited by Dr. Akram Alhammadi Chapter 1: Introduction What Operating Systems Do ماذا تفعل أنظمة التشغيل Computer System Organization تنظيم نظام الحاسوب معمارية نظام الحاسوب Computer System Architecture هيكلية نظام التشغيل Operating System Structure عمليات نظام التشغيل Operating-System Operations إدارة العمليات إدارة الذاكرة Process Management إدارة التخزين Memory Management الحماية واألمان Storage Management Protection and Security Operating System Concepts – 9th Edition 1.2 Silberschatz, Galvin and Gagne ©2013 What is an Operating System? ما هو نظام التشغيل؟ A program that acts as an intermediary between a user of a computer and the computer hardware برنامج يعمل كوسيط بين مستخدم الكمبيوتر وجهاز الكمبيوتر Operating system goals: :أهداف نظام التشغيل Execute user programs and make solving user problems easier تنفيذ برامج المستخدم وتسهيل حل مشاكل المستخدم Make the computer system convenient to use جعل نظام الكمبيوتر مالئمًا لالستخدام Use the computer hardware in an efficient manner استخدم أجهزة الكمبيوتر بطريقة فعالة Operating System Concepts – 9th Edition 1.3 Silberschatz, Galvin and Gagne ©2013 Computer System Structure بنية نظام الحاسوب Computer system can be divided into four :يمكن تقسيم نظام الكمبيوتر إلى أربعة مكونات components: Hardware – provides basic computing توفر موارد الحوسبة األساسية- ❖ األجهزة resources وحدة المعالجة المركزية والذاكرة وأجهزة اإلدخال CPU, memory, I/O devices Operating system واإلخراج Controls and coordinates use of يتحكم وينسق استخدام األجهزة بين- ❖ نظام التشغيل hardware among various applications and users التطبيقات والمستخدمين المختلفين Application programs – define the تحدد الطرق التي تُستخدم بها- ❖ برامج التطبيقات ways in which the system resources are used to solve the computing موارد النظام لحل مشاكل الحوسبة للمستخدمين problems of the users معالجات النصوص والمترجمين ومتصفحات الويب Word processors, compilers, web browsers, database systems, وأنظمة قواعد البيانات وألعاب الفيديو video games ❖ المستخدمون Users األشخاص واآلالت وأجهزة الكمبيوتر األخرى People, machines, other computers Operating System Concepts – 9th Edition 1.4 Silberschatz, Galvin and Gagne ©2013 Four Components of a Computer System المكونات األربعة لنظام الكمبيوتر Operating System Concepts – 9th Edition 1.5 Silberschatz, Galvin and Gagne ©2013 What Operating Systems Do ماذا تفعل أنظمة التشغيل Depends on the point of view يعتمد على وجهة النظر Users want convenience, ease of use and good performance يريد المستخدمون الراحة وسهولة االستخدام واألداء الجيد Don’t care about resource utilization ال يهتم باستغالل الموارد But shared computer such as mainframe or minicomputer must keep all users happy (care about resource utilization) لكن يجب على أجهزة الكمبيوتر المشتركة مثل الحاسوب الرئيسي أو الحاسوب الصغير أن تبقي جميع المستخدمين سعداء )(مع االهتمام باستغالل الموارد Users of dedicate systems such as workstations have dedicated resources but frequently use shared resources from servers(compromise between individual usability and resource utilization) يمتلك مستخدمو األنظمة المخصصة مثل محطات العمل موارد مخصصة ولكنهم يستخدمون بشكل متكرر )موارد مشتركة من الخوادم (التسوية بين قابلية االستخدام الفردية واستخدام الموارد Handheld computers are resource poor, optimized for usability and battery life Some computers have little or no user interface, such as embedded computers in devices and automobiles ومُحسَّنة لسهولة االستخدام وعمر البطارية،أجهزة الكمبيوتر المحمولة فقيرة بالموارد مثل أجهزة الكمبيوتر المضمنة في األجهزة،بعض أجهزة الكمبيوتر بها واجهة مستخدم قليلة أو معدومة والسيارات Operating System Concepts – 9th Edition 1.6 Silberschatz, Galvin and Gagne ©2013 Operating System Definition تعريف نظام التشغيل OS is a resource allocator Manages all resources Decides between conflicting requests for efficient and fair resource use OS is a control program Controls execution of programs to prevent errors and improper use of the computer ▪ نظام التشغيل هو مُخصص للموارد يدير كافة الموارد يقرر بين الطلبات المتضاربة الستخدام الموارد بكفاءة وعدالة ▪ نظام التشغيل هو برنامج تحكم يتحكم في تنفيذ البرامج لمنع األخطاء واالستخدام غير السليم للكمبيوتر Operating System Concepts – 9th Edition 1.7 Silberschatz, Galvin and Gagne ©2013 Operating System Definition (Cont.) )تابع(تعريف نظام التشغيل No universally accepted definition ال يوجد تعريف مقبول عالميًا “The one program running at all times on the computer” is the kernel.."البرنامج الوحيد الذي يعمل في جميع األوقات على الكمبيوتر "هو النواة Everything else is either a system program (ships with the operating system) , or an application program. كل شيء آخر هو برنامج نظام (يأتي مع نظام التشغيل ) او.برنامج تطبيق Operating System Concepts – 9th Edition 1.8 Silberschatz, Galvin and Gagne ©2013 Computer Startup بدء تشغيل الكمبيوتر bootstrap program is loaded at power-up or reboot يتم تحميل برنامج التمهيد عند تشغيل الجهاز أو إعادة تشغيله Typically stored in ROM or EPROM, generally known as firmware والمعروفة عمومًا باسم البرامج الثابتة،EPROM أو ذاكرةROM يتم تخزينه عادةً في ذاكرة Initializes all aspects of system يتم تهيئة جميع جوانب النظام Loads operating system kernel and starts execution يتم تحميل نواة نظام التشغيل وبدء التنفيذ Operating System Concepts – 9th Edition 1.9 Silberschatz, Galvin and Gagne ©2013 Computer System Organization تنظيم نظام الكمبيوتر Computer-system operation تشغيل نظام الحاسوب One or more CPUs, device controllers connect through common bus providing access to shared memory تتصل وحدة المعالجة المركزية ووحدات التحكم في األجهزة واحدة أو أكثر من خالل ناقل مشترك يوفر إمكانية الوصول إلى الذاكرة المشتركة Concurrent execution of CPUs and devices competing for memory cycles التنفيذ المتزامن لوحدات المعالجة المركزية واألجهزة المتنافسة على دورات الذاكرة Operating System Concepts – 9th Edition 1.10 Silberschatz, Galvin and Gagne ©2013 Computer System Operation تشغيل نظام الحاسوب I/O devices and the CPU can execute concurrently يمكن ألجهزة اإلدخال واإلخراج ووحدة المعالجة المركزية التنفيذ في نفس الوقت Each device controller is in charge of a particular device type كل وحدة تحكم في الجهاز مسؤولة عن نوع معين من األجهزة Each device controller has a local buffer كل وحدة تحكم في الجهاز لديها مخزن مؤقت محلي CPU moves data from/to main memory to/from local buffers من المخازن المؤقتة المحلية/إلى الذاكرة الرئيسية إلى/تنقل وحدة المعالجة المركزية البيانات من I/O is from the device to local buffer of controller يتم اإلدخال واإلخراج من الجهاز إلى المخزن المؤقت المحلي لوحدة التحكم Device controller informs CPU that it has finished its operation by causing an interrupt تقوم وحدة التحكم في الجهاز بإبالغ وحدة المعالجة المركزية بأنها أنهت عملها عن طريق التسبب في مقاطعة Operating System Concepts – 9th Edition 1.11 Silberschatz, Galvin and Gagne ©2013 Common Functions of Interrupts الوظائف المشتركة للمقاطعات Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines الذي يحتوي، من خالل متجه المقاطعة،تنقل المقاطعة التحكم إلى روتين خدمة المقاطعة بشكل عام على عناوين جميع روتينات الخدمة Interrupt architecture must save the address of the interrupted instruction يجب أن تقوم هندسة المقاطعة بحفظ عنوان التعليمات التي تمت مقاطعتها A trap or exception is a software-generated interrupt caused either by an error or a user request الفخ أو االستثناء هو مقاطعة تم إنشاؤها بواسطة البرنامج بسبب خطأ أو طلب مستخدم An operating system is interrupt driven نظام التشغيل مدفوع بالمقاطعة Operating System Concepts – 9th Edition 1.12 Silberschatz, Galvin and Gagne ©2013 Interrupt Handling معالجة المقاطعات The operating system preserves the state of the CPU by storing registers and the program counter نظام التشغيل يحافظ على حالة وحدة المعالجة المركزية من خالل تخزين السجالت والعداد البرمجي Program Counter Determines which type of interrupt has occurred: Polling (based on time of interrupt) vectored interrupt system (Based on priority) :▪ يحدد نوع المقاطعة التي حدثت ) االستطالع (بناءً على وقت المقاطعة ) نظام المقاطعة المتجه (بناءً على األولوية Separate segments of code determine what action should be taken for each type of interrupt تحدد أجزاء منفصلة من التعليمات البرمجية اإلجراء الذي يجب اتخاذه لكل نوع من أنواع المقاطعات Operating System Concepts – 9th Edition 1.13 Silberschatz, Galvin and Gagne ©2013 Storage Definitions and Notation Review مراجعة تعريفات التخزين والترميز The basic unit of computer storage is the bit. A bit can contain one of two values, 0 and 1. All other storage in a computer is based on collections of bits. Given enough bits, it is amazing how many things a computer can represent: numbers, letters, images, movies, sounds, documents, and programs, to name a few. A byte is 8 bits, and on most computers it is the smallest convenient chunk of storage. For example, most computers don’t have an instruction to move a bit but do have one to move a byte. A less common term is word, which is a given computer architecture’s native unit of data. A word is made up of one or more bytes. For example, a computer that has 64-bit registers and 64- bit memory addressing typically has 64-bit (8-byte) words. A computer executes many operations in its native word size rather than a byte at a time. Computer storage, along with most computer throughput, is generally measured and manipulated in bytes and collections of bytes. A kilobyte, or KB, is 1,024 bytes a megabyte, or MB, is 1,0242 bytes a gigabyte, or GB, is 1,0243 bytes a terabyte, or TB, is 1,0244 bytes a petabyte, or PB, is 1,0245 bytes Computer manufacturers often round off these numbers and say that a megabyte is 1 million bytes and a gigabyte is 1 billion bytes. Networking measurements are an exception to this general rule; they are given in bits (because networks move data a bit at a time). Operating System Concepts – 9th Edition 1.14 Silberschatz, Galvin and Gagne ©2013 Storage Structure هيكل التخزين Main memory – only large storage media that the CPU can access directly فقط وسائط التخزين الكبيرة التي يمكن لوحدة المعالجة المركزية الوصول إليها مباشرة- الذاكرة الرئيسية Random access الوصول العشوائي Typically volatile متقلب بشكل عام Secondary storage – extension of main memory that provides large nonvolatile storage capacity التخزين الثانوي –امتداد للذاكرة الرئيسية يوفر سعة تخزين كبيرة غير متطايرة Hard disks – rigid metal or glass platters covered with magnetic recording material األقراص الصلبة –أقراص معدنية أو زجاجية صلبة مغطاة بمادة تسجيل مغناطيسية Disk surface is logically divided into tracks, which are subdivided into sectors والتي يتم تقسيمها إلى قطاعات،يتم تقسيم سطح القرص منطقيًا إلى مسارات The disk controller determines the logical interaction between the device and the computer يحدد متحكم القرص التفاعل المنطقي بين الجهاز والكمبيوتر Solid-state disks – faster than hard disks, nonvolatile غير متطايرة،أسرع من األقراص الصلبة- األقراص ذات الحالة الصلبة Various technologies تقنيات مختلفة Becoming more popular تزداد شعبية Operating System Concepts – 9th Edition 1.15 Silberschatz, Galvin and Gagne ©2013 Storage Hierarchy التسلسل الهرمي للتخزين Storage systems organized in hierarchy أنظمة التخزين المنظمة في التسلسل الهرمي Speed السرعة Cost التكلفة التقلب Volatility Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary storage التخزين المؤقت –نسخ المعلومات إلى نظام تخزين أسرع؛ يمكن اعتبار الذاكرة الرئيسية بمثابة ذاكرة تخزين مؤقتة للتخزين الثانوي Device Driver for each device controller to manage I/O اإلخراج/برنامج تشغيل الجهاز لكل وحدة تحكم جهاز إلدارة اإلدخال Provides uniform interface between controller and kernel يوفر واجهة موحدة بين وحدة التحكم والنواة Operating System Concepts – 9th Edition 1.16 Silberschatz, Galvin and Gagne ©2013 Storage Device Hierarchy تسلسل أجهزة التخزين Operating System Concepts – 9th Edition 1.17 Silberschatz, Galvin and Gagne ©2013 Caching التخزين المؤقت Important principle, performed at many levels in a computer (in hardware, )operating system, software مبدأ مهم ،يتم تنفيذه على مستويات عديدة في الكمبيوتر (في األجهزة ،ونظام التشغيل ،والبرامج) Information in use copied from slower to faster storage temporarily يتم نسخ المعلومات المستخدمة من وحدة تخزين أبطأ إلى وحدة تخزين أسرع مؤقتًا Faster storage (cache) checked first to determine if information is there يتم فحص وحدة التخزين األسرع (الذاكرة المؤقتة) أوالً لتحديد ما إذا كانت المعلومات موجودة )If it is, information used directly from the cache (fast إذا كان األمر كذلك ،يتم استخدام المعلومات مباشرة من ذاكرة التخزين المؤقت (سريع) If not, data copied to cache and used there إذا لم يكن األمر كذلك ،يتم نسخ البيانات إلى ذاكرة التخزين المؤقت واستخدامها هناك Cache smaller than storage being cached ذاكرة تخزين مؤقتة أصغر من مساحة التخزين التي يتم تخزينها مؤقتًا Cache size and replacement policy حجم ذاكرة التخزين المؤقت وسياسة االستبدال Operating System Concepts – 9th Edition 1.18 Silberschatz, Galvin and Gagne ©2013 Direct Memory Access Structure بنية الوصول المباشر للذاكرة Used for high-speed I/O devices able to transmit information at close to memory speeds تُستخدم ألجهزة اإلدخال واإلخراج عالية السرعة القادرة على نقل المعلومات بسرعة قريبة من سرعة الذاكرة Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention ينقل وحدة التحكم في الجهاز كتل البيانات من وحدة تخزين المخزن المؤقت مباشرة إلى الذاكرة الرئيسية دون تدخل وحدة المعالجة المركزية Operating System Concepts – 9th Edition 1.19 Silberschatz, Galvin and Gagne ©2013 How a Modern Computer Works كيف يعمل الحاسوب الحديث Operating System Concepts – 9th Edition 1.20 Silberschatz, Galvin and Gagne ©2013 Computer System Architecture هندسة أنظمة الحاسوب Most systems use a single general-purpose processor تستخدم معظم األنظمة معالجًا عامًا واحدًا Most systems have special-purpose processors as well تحتوي معظم األنظمة على معالجات ذات أغراض خاصة أيضًا M ultiprocessors systems growing in use and importance أنظمة المعالجات المتعددة تتزايد في االستخدام واألهمية Also known as parallel systems, tightly-coupled systems تُعرف أيضًا باسم األنظمة المتوازية واألنظمة المقترنة بإحكام Multiprocessor systems have three main advantages: :تتمتع أنظمة المعالجات المتعددة بثالث مزايا رئيسية 1. Increased throughput زيادة اإلنتاجية 2. Economy of scale اقتصاد الحجم 3. Increased reliability – graceful degradation or fault tolerance التدهور السلس أو التسامح مع األخطاء- زيادة الموثوقية Two types: 1. Asymmetric Multiprocessing – each processor is assigned a special task. المعالجة المتعددة غير المتماثلة –يتم تعيين مهمة خاصة لكل معالج 2. Symmetric Multiprocessing – each processor performs all tasks. المعالجة المتعددة المتماثلة –يقوم كل معالج بأداء جميع المهام Operating System Concepts – 9th Edition 1.21 Silberschatz, Galvin and Gagne ©2013 Symmetric Multiprocessing Architecture هندسة المعالجة المتعددة المتماثلة Operating System Concepts – 9th Edition 1.22 Silberschatz, Galvin and Gagne ©2013 A Dual Core Design تصميم ثنائي النواة Multi-chip and multicore متعدد الرقائق ومتعدد النواة Systems containing all chips األنظمة التي تحتوي على كافة الشرائح Chassis containing multiple separate systems هيكل يحتوي على أنظمة منفصلة متعددة Operating System Concepts – 9th Edition 1.23 Silberschatz, Galvin and Gagne ©2013 Clustered Systems األنظمة المجمعة Like multiprocessor systems, but multiple systems working together ولكن أنظمة متعددة تعمل معًا،مثل أنظمة المعالجات المتعددة Usually sharing storage via a storage-area network (SAN) (SAN) عادةً ما تتم مشاركة التخزين عبر شبكة منطقة التخزين Provides a high-availability service which survives failures توفر خدمة ذات توفر عالٍ تنجو من األعطال Asymmetric clustering has one machine in hot-standby mode يحتوي التجميع غير المتماثل على جهاز واحد في وضع االستعداد الساخن Symmetric clustering has multiple nodes running applications, monitoring each other تحتوي المجموعة المتماثلة على عدة عقد تقوم بتشغيل التطبيقات ومراقبة بعضها البعض Some clusters are for high-performance computing (HPC) (HPC) بعض المجموعات مخصصة للحوسبة عالية األداء Applications must be written to use parallelization يجب كتابة التطبيقات الستخدام التوازي Some have distributed lock manager (DLM) to avoid conflicting operations (لتجنب العمليات المتضاربةDLM) قام البعض بتوزيع مدير القفل Operating System Concepts – 9th Edition 1.24 Silberschatz, Galvin and Gagne ©2013 Clustered Systems األنظمة المجمعة Operating System Concepts – 9th Edition 1.25 Silberschatz, Galvin and Gagne ©2013 Operating System Structure بنية نظام التشغيل Multiprogramming (Batch system) needed for البرمجة المتعددة (نظام الدفعات )مطلوبة لتحقيق الكفاءة efficiency Single user cannot keep CPU and I/O devices ال يستطيع المستخدم الفردي إبقاء وحدة المعالجة المركزية وأجهزة busy at all times اإلدخال/اإلخراج مشغولة طوال الوقت Multiprogramming organizes jobs (code and تنظم البرمجة المتعددة الوظائف (الكود والبيانات )بحيث يكون لدى data) so CPU always has one to execute وحدة المعالجة المركزية دائمًا وظيفة واحدة لتنفيذها A subset of total jobs in system is kept in يتم االحتفاظ بمجموعة فرعية من الوظائف اإلجمالية في النظام في memory الذاكرة One job selected and run via job scheduling يتم تحديد وظيفة واحدة وتشغيلها عبر جدولة الوظائف When it has to wait (for I/O for example), OS عندما يتعين عليها االنتظار (لإلدخال/اإلخراج على سبيل المثال)، switches to another job يقوم نظام التشغيل بالتبديل إلى وظيفة أخرى Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can المشاركة الزمنية (تعدد المهام )هي امتداد منطقي حيث تقوم وحدة interact with each job while it is running, creating interactive computing المعالجة المركزية بتبديل الوظائف بشكل متكرر بحيث يمكن للمستخدمين التفاعل مع كل وظيفة أثناء تشغيلها ،مما يخلق حوسبة تفاعلية Response time should be < 1 second يجب أن يكون وقت االستجابة أقل من ثانية واحدة Each user has at least one program executing in يوجد لدى كل مستخدم برنامج واحد على األقل يتم تنفيذه في الذاكرة memory process process جدولة If several jobs ready to run at the same time إذا كانت هناك عدة وظائف جاهزة للتشغيل في نفس الوقت CPU scheduling وحدة المعالجة المركزية If processes don’t fit in memory, swapping إذا لم تتناسب العمليات مع الذاكرة ،فإن التبديل ينقلها إلى الداخل moves them in and out to run والخارج للتشغيل تسمح الذاكرة االفتراضية بتنفيذ العمليات غير الموجودة بالكامل في Virtual memory allows execution of processes not completely in memory الذاكرة – Operating System Concepts 9th Edition 1.26 Silberschatz, Galvin and Gagne ©2013