Operating System Fundamentals: Operating Systems Structures PDF

Document Details

GlamorousSpruce4081

Uploaded by GlamorousSpruce4081

Mansoura University

2024

Mohamed Handosa

Tags

operating system operating systems structures system calls computer science

Summary

This document presents lecture notes on Operating System Fundamentals, specifically focusing on Operating System Structures. It covers topics such as operating system services, system calls, and various approaches to operating system structure, including monolithic, layered, micro-kernel, and hybrid approaches.

Full Transcript

Information Technology Institute Operating System Fundamentals Operating Systems Structures Dr. Mohamed Handosa Mansoura University [email protected] Topics 2.1. Operating system services 2.2. System calls 2.3. Types of system calls 2.4. System boot...

Information Technology Institute Operating System Fundamentals Operating Systems Structures Dr. Mohamed Handosa Mansoura University [email protected] Topics 2.1. Operating system services 2.2. System calls 2.3. Types of system calls 2.4. System boot 2.5. Operating system structure 2 Operating System Services 3 Operating System Services (1 of 2) User interface Provide a graphical user interface (GUI) or a command-line interface (CLI). Program execution Load programs into memory and run them. A program must be able to end its execution, either normally or abnormally. I/O operations User processes cannot execute I/O operations directly. Therefore, the OS must provide processes with some means to perform I/O. 4 Operating System Services ( 2 of 2) File-system manipulation Allow user processes to read, write, create, and delete files. Communications Enable user processes to exchange information. Implemented via shared memory or message passing. Error detection Ensure correct computing by detecting errors in hardware or user programs. 5 Additional Operating System Functions Resource allocation Allocate resources to the running processes. Logging Recording which process uses how much and what kinds of resources. This record may be used for account billing or accumulating usage statistics. Protection and Security Protection ensures that all access to system resources is controlled. The security of the system from outsiders is also important. 6 System Calls 7 System Calls Provide an interface to the services provided by the OS. User processes can use system calls to call the OS services. System calls are available as functions written in C and C++. Some low-level tasks may be written using assembly-language. When a process executes a system call, the system traps to the OS. The OS provides application programmers with API to invoke services. API = Application Programming Interface 8 System Call Example Operating Systems Concepts 10th Edition 9 Passing Parameters to System Calls Method 1: Pass the parameters in CPU registers. Method 2: Store the parameters in a table in memory (block) and pass the address of the block as a parameter in a CPU register. Method 3: Push the parameters onto the stack by the process, and later pop them of the stack by the operating system. 10 Passing Parameters (Method 2) Operating Systems Concepts 10th Edition 11 Types of System Calls (1 of 2) Process control Create, load, execute, terminate, and abort. Get process attributes and set process attributes. Wait for time, wait event, signal even, allocate and free memory. File management Create file and delete file. Open, close, read, write, reposition file. Get file attributes and set file attributes. Device management Request device, release device, read, write, reposition. Get and set device attributes, logically attach or detach devices. 12 Types of System Calls (2 of 2) Information maintenance Get time/date, set time/date Get system data, set system data Get process, file, or device attributes, set process, file, or device attributes. Communications Create, delete communication connection. Send message, receive message, transfer status information Attach remote device, detach remote device. 13 System Boot 14 System Boot The process of starting a computer by loading the kernel. On most systems, the boot process proceeds as follows: 1. The bootstrap program locates the kernel. 2. The kernel is loaded into memory and started. 3. The kernel initializes hardware. 4. The root file system is mounted. 15 Operating System Structures Monolithic Approach Modules Approach Layered Approach Hybrid Approach Micro-kernel Approach 16 Monolithic Approach No structure at all. Difficult to implement and extend. Communication within the kernel is fast. Very little overhead in the system-call interface. A single, static binary file that runs in a single address space. Tightly-coupled as changes to one part can affect other parts. Several OSs use of this approach, such as UNIX, Linux, and Windows. 17 Layered Approach Divides the OS into a set of layers. Makes it easier to implement and extend the kernel. Each layer uses the functions of only the lower-level layers. Therefore, it is difficult to define the functionality of each layer. Loosely-coupled as changes in one layer do not affect the others. Traversing multiple layers to call services results in poor performance. 18 Layered Approach Bottom layer (layer 0), hardware. Highest layer (layer 𝑁), user interface. Operating Systems Concepts 10th Edition 19 Micro-kernel Approach Removes all nonessential components from the kernel and implements them as system programs. Operating Systems Concepts 10th Edition 20 Advantages of the Micro-kernel Approach It is easier to extend the OS. No need to modify of the kernel. New services are added as system programs It is easier to modify kernel if needed as it is a smaller kernel. It is easier to port the OS from one hardware design to another. It provides more security and reliability. Most services are running as user rather than kernel processes. If a service fails, the rest of the operating system remains untouched. 21 Modules Approach The kernel has a set of core components and can link in additional services via LKMs, either at boot time or during run time. Linking additional services dynamically is preferable to recompiling the kernel every time a change is made. This type of design is common in modern implementations of UNIX, such as Linux, macOS, and Solaris, as well as Windows. LKM = Loadable Kernel Module 22 Modules Approach versus Other Approaches Layered approach Similarity: each kernel section has a defined and protected interface. Difference: more flexible, because any module can call any other module. Microkernel approach Similarity: the primary module has only core functions. Difference: modules do not need to use message passing to communicate. 23 Hybrid Approach In practice, very few OSs adopt a single, strictly defined structure. Instead, they combine different structures, resulting in hybrid systems that address performance, security, and usability issues. For example, Linux is both monolithic and modular: Monolithic: to provide very efficient performance. Modular: to add new functionality dynamically to the kernel. 24 Thank You 25

Use Quizgecko on...
Browser
Browser