Lecture 2: Systems Structures - Operating System Design & Implementation PDF

Document Details

RecordSettingAmethyst

Uploaded by RecordSettingAmethyst

Alexandria University

Dr.Ahmed Zekri

Tags

operating systems computer science system design lecture notes

Summary

This document is a lecture on operating system design and implementation. It covers various topics including operating system services, system calls, and different structures, including microkernels and modules.

Full Transcript

Lecture 2 Systems Structures Chapter 2 Adapted from textbook slides, 8th ed. 1 Dr.Ahmed Zekri, Alexandria University Contents Operating System Services User Interface System Calls and their types System Programs O...

Lecture 2 Systems Structures Chapter 2 Adapted from textbook slides, 8th ed. 1 Dr.Ahmed Zekri, Alexandria University Contents Operating System Services User Interface System Calls and their types System Programs OS Design and Implementation OS Structure 2 Dr.Ahmed Zekri, Alexandria University APIs 3 Dr.Ahmed Zekri, Alexandria University 4 Dr.Ahmed Zekri, Alexandria University 5 Dr.Ahmed Zekri, Alexandria University 6 Dr.Ahmed Zekri, Alexandria University Contents Operating System Services User Interface System Calls and their types System Programs OS Design and Implementation OS Structure 7 Dr.Ahmed Zekri, Alexandria University Sometimes Assembly is used. 8 Dr.Ahmed Zekri, Alexandria University Using C language API User mode Kernel mode 9 Dr.Ahmed Zekri, Alexandria University Sequence of system calls to accomplish this task. The files names are input from command line. 10 Dr.Ahmed Zekri, Alexandria University Exercise: Give three examples of system calls from your textbook that belong to each of the above types? Then, explain the function of each system call briefly. What is the actual name of each system call in Win32 API and POSIX API? 11 Dr.Ahmed Zekri, Alexandria University 12 Dr.Ahmed Zekri, Alexandria University 13 Dr.Ahmed Zekri, Alexandria University Contents Operating System Services User Interface System Calls and their types System Programs OS Design and Implementation OS Structure 14 Dr.Ahmed Zekri, Alexandria University (Software engineering methodologies are applicable) of requirements Q: define: Single user, multi-user, time-sharing, batch, distributed, real-time, … 15 Dr.Ahmed Zekri, Alexandria University Example: Timer construct is a mechanism ensuring CPU protection from unlimited loops in time-sharing systems. But, deciding how long the timer is to be set for a particular user is a policy decision. Q: Which one may frequently change: policy, mechanism, or both? Why? Give examples to support your answers. 16 Dr.Ahmed Zekri, Alexandria University OS implementation: HLL vs Assembly Lang….(1) Page 69, 8th ed. Once an operating system is designed, it must be implemented. Traditionally, operating systems have been written in assembly language. Now, however, they are most commonly written in a higher-level language such as C or C++. 17 Dr.Ahmed Zekri, Alexandria University OS implementation: HLL vs Assembly Lang… (2) The first system that was not written in assembly language was probably the Master Control Program (MCP) for Burroughs computers. MCP was written in a variant of ALGOL. MULTICS, developed at MIT, was written mainly in PL/1. The Linux and Windows XP operating systems are written mostly in C, although there are some small sections of assembly code for device drivers and for saving and restoring the state of registers. Question: What are the pros and cons of implementing OS using either a high level language like c, or an assembly language of a given architecture? 18 Dr.Ahmed Zekri, Alexandria University OS structure A contemporary OS can function properly and be modified easily if it has a good design. A common approach is to partition the system into smaller modules/components rather than one monolithic system. Each module has a well-defined function(s) in terms of input, output and processing. 19 Dr.Ahmed Zekri, Alexandria University OS structure … Common OS structures: – Simple structure – Layered – Micro-kernels – Modules 20 Dr.Ahmed Zekri, Alexandria University 1 User programs can directly access the IO routines! 21 Dr.Ahmed Zekri, Alexandria University This is not the true layered approach discussed next. (it is considered a simple structure!) 22 Dr.Ahmed Zekri, Alexandria University 23 Dr.Ahmed Zekri, Alexandria University Though looks layered, the kernel layer is much complex and included many functions. 24 Dr.Ahmed Zekri, Alexandria University 2 Lower-level layers can be easily modified without major changes to the above layer. Ease of design and debugging. The issue is how to divide the functions into layers! As the number of layers increases, the overhead of calling each layer up to the user program becomes higher. 25 Dr.Ahmed Zekri, Alexandria University 2 e.g. Windows NT 26 Dr.Ahmed Zekri, Alexandria University 2 Example This example shows how to select the functions into each layer such that that layer uses functions from the below one. The device driver for the backing store (disk space used by virtual-memory algorithms) must be at a lower level than the memory-management routines, because memory management requires the ability to use the backing store. 27 Dr.Ahmed Zekri, Alexandria University 2 Problem with Layered approach A final problem with layered implementations is that they tend to be less efficient than other types. For instance, when a user program executes an I/O operation, it executes a system call that is trapped to the I/O layer, which calls the memory-management layer, which in turn calls the CPU-scheduling layer, which is then passed to the hardware. At each layer, the parameters may be modified, data may need to be passed, and so on. Each layer adds overhead to the system call; the net result is a system call that takes longer than does one on a nonlayered system. 28 Dr.Ahmed Zekri, Alexandria University 3 through the kernel (the OS itself) 29 Dr.Ahmed Zekri, Alexandria University 3 Example If the client program wishes to access a file, it must interact with the file server. The client program and service never interact (Micro-kernel) directly. Rather, they communicate indirectly by exchanging messages with the microkernel. Microkernel in Operating Systems - GeeksforGeeks 30 Dr.Ahmed Zekri, Alexandria University 3 OS Examples 31 Dr.Ahmed Zekri, Alexandria University 4 32 Dr.Ahmed Zekri, Alexandria University 4 33 Dr.Ahmed Zekri, Alexandria University 4 OS Examples 34 Dr.Ahmed Zekri, Alexandria University Has dynamically loadable modules (which Mac OS X refers to as kernel extensions) The Apple Mac OS X hybrid (layers & modules )structure 35 Dr.Ahmed Zekri, Alexandria University 36 Dr.Ahmed Zekri, Alexandria University Virtualization The layered approach described before is taken to its logical conclusion in the concept of a virtual machine (VM). The fundamental idea behind a VM is to abstract the hardware of a single computer (CPU, RAM, disk drives, NIC cards, and so forth) into several different execution environments, thereby creating the illusion that each separate execution environment is running its own private computer. 37 Dr.Ahmed Zekri, Alexandria University Virtualization Guest OS Host OS Need CPU scheduling & virtual-memory techniques 38 Dr.Ahmed Zekri, Alexandria University Benefits share the same hardware to run several different execution environments (i.e., different OSs) concurrently. the host system is protected from the virtual machines, just as the virtual machines are protected from each other Easily testing OSs during development (no dedicated machine to install and test) Server consolidation: taking two or more separate systems and running them in virtual machines on one 39 system Dr.Ahmed Zekri, Alexandria University VMware example 40 Dr.Ahmed Zekri, Alexandria University [COMPLEMENTARY MATERIAL] 41 Dr.Ahmed Zekri, Alexandria University 42 Dr.Ahmed Zekri, Alexandria University 43 Dr.Ahmed Zekri, Alexandria University HW: OS booting What are the bootstrap program and bootstrap loader? Where they reside in a computer? And why? 44 Dr.Ahmed Zekri, Alexandria University HW: microkernel design What is the microkernel design approach of operating systems? – Explain the basic idea about the microkernel design approach. – Give examples of operating systems that followed this design approach. What are the advantages and disadvantages of this design approach? 45 Dr.Ahmed Zekri, Alexandria University Home Work Answer the questions raised in the lecture slides. Due before next lecture. 46 Dr.Ahmed Zekri, Alexandria University

Use Quizgecko on...
Browser
Browser