Introduction 1.1 What Operating Systems Do? 1. The hardware — the central processing unit (CPU), the memory, and the input/output (I/O) devices — provides the basic computing resources for the system. The application programs — such as word processors, spreadsheets, compilers, and web browsers — define the ways in which these resources are used to solve users’ computing problems. The operating system controls the hardware and coordinates its use among the various application programs for the various users. ()ٌوفر الجهاز موارد الحوسبة األساسٌة للنظام 2. We can also view a computer system as consisting of hardware, software, and data. The operating system provides the means for proper use of these resources in the operation of the computer system. An operating system is similar to a government. Like a government, it performs no useful function by itself. It simply provides an environment within which other programs can do useful work. ()ٌوفر نظام التشغٌل وسائل االستخدام الصحٌح لهذه الموارد فً تشغٌل نظام الكمبٌوتر To understand more fully the operating system’s role, we next explore operating systems from two viewpoints: that of the user and that of the system. 1.1.1 User View The user’s view of the computer varies according to the interface being used. 1. system is designed for one user to monopolize its resources. 2. The goal is to maximize the work (or play) that the user is performing. 3. In this case, the operating system is designed mostly for ease of use, with some attention paid to performance and security and none paid to resource utilization . تن تصوين النظام لوستخذم ًاحذ الحتكار هٌارده.1 . اليذف ىٌ تعظين العول (أً اللعب) الذي يؤديو الوستخذم.2 هع إيالء بعض االىتوام لألداء ًاألهن ًعذم، تن تصوين نظام التشغيل في الغالب لسيٌلة االستخذام، في ىذه الحالة.3 دفع أي شيء الستخذام الوٌارد 1.1.2 System View 1. we can view an operating system as a resource allocator. A computer system has many resources that may be required to solve a problem: CPU time, memory space, storage space, I/O devices, and so on. .ٌمكننا عرض نظام التشغٌل كمخصص موارد 2. The operating system acts as the manager of these resources. Facing numerous and possibly conflicting requests for resources, the operating system must decide how to allocate them to specific programs and users so that it can operate the computer system efficiently and fairly. .ٌعمل نظام التشغٌل كمدٌر لهذه الموارد 1.1.3 Defining Operating Systems 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: 1. Execute user programs and make solving user problems easier 2. Make the computer system convenient to use 3. Use the computer hardware in an efficient manner Computer Startup: bootstrap program is loaded at power-up or reboot Typically stored in ROM or EPROM, generally known as firmware Initializes all aspects of system Loads operating system kernel and starts execution OS : “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. 1 .2 Computer-System Organization A modern general-purpose computer system consists of one or more CPUs and a number of device controllers connected through a common bus that provides access between components and shared memory Each device controller is in charge of a specific type of device (for example, a disk drive, audio device, or graphics display). A device controller maintains some local buffer storage and a set of specialpurpose registers. The device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage. Typically, operating systems have a device driver for each device controller. The CPU and the device controllers can execute in parallel, competing for memory cycles. To ensure orderly access to the shared memory, a memory controller synchronizes access to the memory. .1 .2 .3 .4 .5 .6 .7 1. 2. 3. 4. 5. 6. ٌتكون نظام الكمبٌوتر العصري لألغراض العامة من وحدة معالجة مركزٌة واحدة أو أكثر وعدد من وحدات التحكم باألجهزة المتصلة عبر ناقل عام ٌوفر الوصول بٌن المكونات والذاكرة المشتركة كل وحدة تحكم فً الجهاز مسؤولة عن نوع معٌن من األجهزة (على سبٌل المثال ،محرك األقراص أو جهاز الصوت أو عرض الرسومات). تحافظ وحدة التحكم فً الجهاز على بعض وحدات التخزٌن المؤقتة المحلٌة ومجموعة من السجالت ذات األغراض الخاصة. وحدة التحكم فً الجهاز مسؤولة عن نقل البٌانات بٌن األجهزة الطرفٌة التً تتحكم فٌها وتخزٌنها فً المخزن المؤقت المحلً. عادة ً ما تحتوي أنظمة التشغٌل على برنامج تشغٌل جهاز لكل جهاز تحكم فً الجهاز. متواز ٌ ،تنافسان على دورات الذاكرة .لضمان الوصول المنظم إلى ٌمكن تنفٌذ وحدة المعالجة المركزٌة ووحدات التحكم فً الجهاز بشكل ٍ الذاكرة المشتركة ،تتم مزامنة وحدة تحكم الذاكرة الوصول إلى الذاكرة. فً األقسام الفرعٌة التالٌة ،نصف بعض األساسٌات لكٌفٌة عمل هذا النظام ،مع التركٌز على ثالثة جوانب رئٌسٌة للنظام .نبدأ مع المقاطعات ،والتً تنبه وحدة المعالجة المركزٌة إلى األحداث التً تتطلب االهتمام .ثم نناقش بنٌة التخزٌن وهٌكل اإلدخال /اإلخراج. Interrupts 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 Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt A trap is a software-generated interrupt caused either by an error or a user request An operating system is interrupt driven Interrupt Handling: The operating system preserves the state of the CPU by storing registers and the program counter Separate segments of code determine what action should be taken for each type of interrupt Storage structure Main memory – only large storage media that the CPU can access directly Secondary storage – extension of main memory that provides large nonvolatile storage capacity Magnetic 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 Storage Hierarchy Storage systems organized in hierarchy 1. Speed 2. Cost 3. Volatility Caching – copying information into faster storage system; main memory can be viewed as a last cache for secondary storage 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 I/O structure After I/O starts, control returns to user program only upon I/O completion 1. Wait instruction idles the CPU until the next interrupt 2. Wait loop (contention for memory access) 3. At most one I/O request is outstanding at a time, no simultaneous I/O processing After I/O starts, control returns to user program without waiting for I/O completion 1. System call – request to the operating system to allow user to wait for I/O completion 2. Device-status table contains entry for each I/O device indicating its type, address, and state 3. Operating system indexes into I/O device table to determine device status and to modify table entry to include interrupt 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 Only one interrupt is generated per block, rather than the one interrupt per byte 1.3 Computer-System Architecture A computer system can be organized in a number of different ways,which we can categorize roughly according to the number of general-purpose processors used. 1.3.1 Single-Processor Systems Many years ago, most computer systems used a single processor containing one CPU with a single processing core. (The core is the component that executes instructions and registers for storing data locally). _____________________________________ 1.3.2 Multiprocessor Systems On modern computers, from mobile devices to servers, multiprocessor systems now dominate the landscape of computing. Traditionally, such systems have two (or more) processors, each with a single-core CPU. The processors share the computer bus and sometimes the clock, memory, and peripheral devices. The primary advantage of multiprocessor systems is increased throughput. That is, by increasing the number of processors, we expect to get more work done in less time. . تهٌمن أنظمة المعالجات المتعددة اآلن على مشهد الحوسبة، من األجهزة المحمولة إلى الخوادم، على أجهزة الكمبٌوتر الحدٌثة تشترك المعالجات. ولكل منها وحدة المعالجة المركزٌة أحادٌة النواة، مثل هذه األنظمة لدٌها اثنٌن (أو أكثر) من المعالجات، تقلٌدٌا أي. ٌتم زٌادة المٌزة األساسٌة ألنظمة المعالجات المتعددة اإلنتاجٌة.فً ناقل الكمبٌوتر وأحٌانًا الساعة والذاكرة واألجهزة الطرفٌة . نتوقع إنجاز المزٌد من العمل فً وقت أقل، بزٌادة عدد المعالجات (Multiprocessors systems growing in use and importance) (Also known as parallel systems, tightly-coupled systems) Advantages include: 1. Increased throughput .زٌادة عدد العملٌات المنفذة فً الثانٌة الواحدة 2. Economy of scale اقتصادٌة 3. Increased reliability – graceful degradation or fault tolerance .زٌادة الموثوقٌة Two types: 1. Asymmetric Multiprocessing كل معالج تخصص له مهمة خاصة او مستقة 2. Symmetric Multiprocessing كل المعالجات تقوم بكل الوظائف Example : Multi core ( A Dual-Core Design) 1.3.3 Clustered Systems Another type of multiprocessor system is a clustered system, which gathers together multiple CPUs. Clustered systems differ from the multiprocessor systems in that they are composed of two or more individual systems — or nodes — joined together; each node is typically a multicore system. Such systems are considered loosely coupled. تختلف األنظمة المجمعة عن. والذي ٌجمع عدة وحدات المعالجة المركزٌة، نوع آخر من نظام متعدد المعالجات هو نظام مجمع مرتبطة معًا ؛ كل عقدة هً عادة- أو العقد- األنظمة متعددة المعالجات من حٌث أنها تتألف من نظامٌن أو أكثر من األنظمة الفردٌة . مثل هذه األنظمة تعتبر مترابطه.نظام متعدد النواة _____________________________________ Like multiprocessor systems, but multiple systems working together لكن أنظمة متعددة تعمل معًا، مثل أنظمة المعالجات المتعددة Type: Asymmetric clustering has one machine in hot-standby mode ٌحتوي التجمٌع غٌر المتماثل على جهاز واحد فً وضع االستعداد السرٌع Symmetric clustering has multiple nodes running applications, monitoring each other وتراقب بعضها البعض، التجمٌع المتماثل له عدة عقد تشغل التطبٌقات o Usually sharing storage via a storage-area network (SAN) )SAN( عادةً مشاركة التخزٌن عبر شبكة منطقة تخزٌن o Provides a high-availability, high-performance service which survives failures ٌوفر خدمة عالٌة األداء وعالٌة األداء تنجو من حاالت الفشل o Some clusters are for high-performance computing (HPC) )HPC( بعض المجموعات مخصصة للحوسبة عالٌة األداء _____________________________________ 1.4 Computer System Structure: Computer system can be divided into four components: 1. Hardware – provides basic computing resources CPU, memory, I/O devices 2. Operating system Controls and coordinates use of hardware among various applications and users 3. 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 4. Users People, machines, other computers 1.5 Computer-System Operation: The controller starts the transfer of data from the device to its local buffer. Once the transfer of data is complete, the device controller informs the device driver that it has finished its operation. The device driver then gives control to other parts of the operating system , But how does the controller inform the deviced river that it has finished its operation? This is accomplished via an interrupt. تبلغ وحدة التحكم فً الجهاز برنامج، بمجرد اكتمال نقل البٌانات.تبدأ وحدة التحكم فً نقل البٌانات من الجهاز إلى المخزن المؤقت المحلً الخاص به لكن كٌف ٌعلم المراقب، ٌمنح برنامج تشغٌل الجهاز التحكم فً األجزاء األخرى من نظام التشغٌل، بعد ذلك.تشغٌل الجهاز أنه قد انتهى من تشغٌله .المتحكم النهر الذي تم إنشائه بأنه قد انتهى من تشغٌله؟ وٌتم ذلك عن طرٌق المقاطعة 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 -------------------------------------------------------------------------------------------------------------------------------Copyright – Ashraf Mohammed Salih -18/12/2019