UNIX • UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts – Systems programs – The kernel • Consists of everything below the system-call interface and above the physical hardware • Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 2 UNIX System Structure
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 3
UNIX Kernel Space
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 4
Linux System Structure
Monolithic with Modular Design
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 5
Microkernel System Structure • Moves as much from the kernel into “user” space • Communication takes place between user modules using message passing • Kernel consist of only essential components • The kernel will be very small • Main function of the Micro kernel is to provide communication facility (using Message passing) • Benefits: – Easier to extend a microkernel – Easier to port the operating system to new architectures – More reliable (less code is running in kernel mode) – More secure • Detriments: – Performance overhead of user space to kernel space communication January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 6 Microkernel System Structure
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 7
Monolithic Vs Micro Kernel
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 8
Modules • Most modern operating systems implement kernel 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 with more flexible – Linux, Solaris January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 9 Solaris Modular Approach
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 10
Hybrid Systems • Most modern OSs are actually not one pure model – Hybrid combines multiple approaches to address performance, security, usability needs – Linux and Solaris kernels in kernel address space are monolithic and are modular for dynamic loading of functionality – Windows mostly monolithic, plus microkernel for different subsystem personalities
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 11
Why Applications are OS Specific? • Apps compiled on one system usually not executable on other OS • Each OS provides its own unique system calls, file formats etc.. • Apps can be multi-operating system – Written in interpreted language like Python, Ruby, and interpreter available on multiple OSs – App written in language that includes a VM containing the running app (like Java) – Use standard language (like C), compile separately on each OS to run on each • Application Binary Interface (ABI) is architecture equivalent of API, defines how different components of binary code can interface for a given operating system on a given architecture, CPU, etc . January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 12 System Design • System Design Goals – User goals – operating system should be convenient to use, easy to learn, reliable, safe, and fast. – System goals – operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient • Mechanisms and Policies – 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. January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 13 System Implementation • Traditionally written in assembly language, operating systems can now be written in higher- level languages. • Code written in a high-level language: – can be written faster. – is more compact. – is easier to understand and debug. • An operating system is far easier to port (move to some other hardware) if it is written in a high-level language. January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 14 General System Architecture • Why we need protection? – In single task / programming environment • To protect OS from incorrect program – In multiprogramming / multitasking environment • To protect OS and other programs from incorrect program
• Given the I/O instructions are privileged, how does
the user program perform I/O? January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 15 Use of a System call to perform I/O
January 22, 2024 Biju K Raveendran @ BITS Pilani Goa 16