Presentation is loading. Please wait.

Presentation is loading. Please wait.

CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:

Similar presentations


Presentation on theme: "CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:"— Presentation transcript:

1 CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL: http://kovan.ceng.metu.edu.tr/~erol/Courses/CENG334 Operating System Design and Implementation Topics OS structures Some of the following slides are adapted from Matt Welsh, Harvard Univ.

2 2 OS design and implementation There is no ultimate OS that would satisfy all requirements: Trade-offs have to made at each level and for all aspects. Important principle to separate Policy: What will be done? Mechanism: How to do it? Mechanisms determine how to do something, policies decide what will be done The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later

3 3 Operating Systems Structure (What is the organizational Principle?)‏ Simple Only one or two levels of code Layered Lower levels independent of upper levels Microkernel OS built from many user-level processes Modular Core kernel with Dynamically loadable modules

4 4 Simple Structure MS-DOS – written to provide the most functionality in the least space Not divided into modules Interfaces and levels of functionality not well separated

5 5 Monolithic Kernels Most common OS kernel design (used in UNIX and Linux)‏ Kernel code is privileged and lives in its own address space User applications are unprivileged and live in their own separate address spaces All kernel functions loaded into memory as one large, messy program Pros and cons??? User application System call User application Kernel Memory management Disk I/O Process management Device drivers Filesystem TCP/IP stack Accounting CPU support Protection boundary

6 6 Monolithic Kernels Most common OS kernel design Kernel code is privileged and lives in its own address space User applications are unprivileged and live in their own separate address spaces All kernel functions loaded into memory as one large, messy program Pros and cons Pro: Overhead of module interactions within the kernel is low (function call)‏ Pro: Kernel modules can directly share memory Con: Very complicated and difficult to organize Con: A bug in any part of the kernel can crash the whole system! User application System call User application Kernel Memory management Disk I/O Process management Device drivers Filesystem TCP/IP stack Accounting CPU support Protection boundary

7 7 Layered kernels Operating system is divided many layers (levels) Each built on top of lower layers Bottom layer (layer 0) is hardware Highest layer (layer N) is the user interface Each layer uses functions (operations) and services of only lower-level layers Advantage: modularity  Easier debugging/Maintenance Not always possible: Does process scheduler lie above or below virtual memory layer? Need to reschedule processor while waiting for paging May need to page in information about tasks Important: Machine-dependent vs independent layers Easier migration between platforms Easier evolution of hardware platform

8 8 Microkernels Use a very small, minimal kernel, and implement all other functionality as user level “servers” Kernel only knows how to perform lowest-level hardware operations Device drivers, filesystems, virtual memory, etc. all implemented on top Use inter-process procedure call (IPC) to communicate between applications and servers Pros and Cons??? User application Protection boundary Microkernel Memory management Disk I/O Process management Filesystem TCP/IP stack Accounting CPU support Device drivers Inter-process procedure call

9 9 Microkernels - 2 Pros and cons Pro: Kernel is small and simple, servers are protected from each other Con: Overhead of invoking servers may be very high e.g., A user process accessing a file may require inter-process communication through 2 or 3 servers! Microkernels today Lots of research in late 80's and early 90's Windows NT uses “modified microkernel”: Monolithic kernel for most things, OS APIs (DOS, Win3.1, Win32, POSIX) implemented as user-level services Mac OS X has reincarnated the microkernel architecture as well: Gnarly hybrid of Mach (microkernel) and FreeBSD (monolithic)

10 10 Modules-based Structure Most modern operating systems implement modules Uses object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel Overall, similar to layers but more flexible


Download ppt "CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:"

Similar presentations


Ads by Google