Introduction to Operating Systems (Part III)

Similar documents
Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023

Chapter 2. Operating-System Structures

Operating-System Structures

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Chapter 2: Operating-System Structures

Chapter 2: System Structures

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edition

Operating System Services. User Services. System Operation Services. User Operating System Interface - CLI. A View of Operating System Services

What are some common categories of system calls? What are common ways of structuring an OS? What are the principles behind OS design and

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Debugging: Love It, Hate It Or Reverse It?

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

Lecture 2 Operating System Structures (chapter 2)

Chapter 2: System Structures

Chapter 2: Operating-System

Chapter 2: System Structures. Operating System Concepts 9 th Edition

Chapter 2: Operating-System Structures. Operating System Concepts 8 th Edition

Chapter 2: Operating-System Structures

Four Components of a Computer System

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

Chapter 2: Operating-System Structures. Chapter 2: Operating-System Structures. Objectives. Operating System Services

CSE 4/521 Introduction to Operating Systems

Chapter 2: Operating-System Structures

Chapter 2 Operating-System Structures

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Inside ptmalloc2. Peng Xu Sep 14, 2013

Chapter 2: Operating-System Structures

DEBUGGING: TESTING WS 2017/2018. Martina Seidl Institute for Formal Models and Verification

Chapter 2: Operating-System Structures

Often, more information is required when designing system call Information varies according to OS and types of system call

Operating-System Structures

CS420: Operating Systems. OS Services & System Calls

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

CSC Operating Systems Spring Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. January 17 th, 2007.

Announcements. Operating System Structure. Roadmap. Operating System Structure. Multitasking Example. Tevfik Ko!ar

Operating System Structure

TDDI04, K. Arvidsson, IDA, Linköpings universitet Operating System Structures. Operating System Structures Overview. Operating System Services

CS307: Operating Systems

Operating System Structure

Operating-System Structures

CHIRP - Bug # Baofeng 997-S - CHIRP - No Response Issue Description. I have reviewed redmine ticket 1957 and the rejected ticket 2471

Chapter 2: System Structures. Operating System Concepts 9 th Edition

Operating System Architecture. CS3026 Operating Systems Lecture 03

OPERATING SYSTEMS. Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne

Operating System Structure

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

Architectural Support for Operating Systems. Jinkyu Jeong ( Computer Systems Laboratory Sungkyunkwan University

CSE 333 Lecture 8 - system calls, intro to file I/O

CSE 333 Lecture 6 - system calls, intro to file I/O

OS Design Approaches. Roadmap. OS Design Approaches. Tevfik Koşar. Operating System Design and Implementation

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Module 3: Operating-System Structures. Common System Components

C provides some basic facilities C libraries help make those primitive facilities useful

Chapter 3: Operating-System Structures

Module 1 Introduction/OS Overview

Low-Level I/O, C++ Preview

Chapter 3: Operating-System Structures

Chapter 2 Operating System Structures

Chapter 2: OS Structures

Chapter 2. Operating System Structures

CS370 Operating Systems

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation

OS Design Approaches. Roadmap. System Calls. Tevfik Koşar. Operating System Design and Implementation. CSE 421/521 - Operating Systems Fall 2013

OS Structures. ICS332 Operating Systems

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

Module 3: Operating-System Structures

System Call. Preview. System Call. System Call. System Call 9/7/2018

CSC 453 Operating Systems

Operating System Services

Spring It takes a really bad school to ruin a good student and a really fantastic school to rescue a bad student. Dennis J.

Introduction to Operating Systems (Part II)

OS concepts and structure. q OS components & interconnects q Structuring OSs q Next time: Processes

Lecture 2 - Fundamental Concepts

System Call System Program Linker/Loader with Examples Types of computing Environment

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

Operating-System Structures

What we saw. Desarrollo de Aplicaciones en Red. 1. OS Design. 2. Service description. 1.1 Operating System Service (1)

CSE Opera+ng System Principles

Full file at

Chapter 3: Operating-System Structures

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

! Software ( kernel ) that runs at all times. ! OS performs two unrelated functions: Maria Hybinette, UGA. user! 1! Maria Hybinette, UGA. user! n!

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd:

EEE 435 Principles of Operating Systems

TDDB68 Concurrent Programming and Operating Systems. Lecture 1: Introduction, interrupts and system calls

Operating- System Structures

COS 318: Operating Systems

Unit 2 : Computer and Operating System Structure

UNIT 2. OPERATING SYSTEM STRUCTURES

1 System & Activities

OPERATING SYSTEMS UNIT - 1

Operating Systems, Fall

Transcription:

Introduction to Operating Systems (Part III) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 1 / 43

Operating System Structure Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 2 / 43

Operating System Structure Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 3 / 43

User Space System programs Application programs Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 4 / 43

Kernel Space Process management Memory management Storage management and File system Device control and I/O subsystem Protection and security Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 5 / 43

System Calls Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 6 / 43

System Calls Programming interface to the services provided by the OS. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 7 / 43

System Calls Programming interface to the services provided by the OS. Typically written in a high-level language (C or C++). Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 7 / 43

System Calls Programming interface to the services provided by the OS. Typically written in a high-level language (C or C++). Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call use. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 7 / 43

Application Programming Interface (API) The API specifies a set of functions that are available to an application programmer. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 8 / 43

Application Programming Interface (API) The API specifies a set of functions that are available to an application programmer. It includes the parameters that are passed to each function and the return values the programmer can expect. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 8 / 43

Application Programming Interface (API) The API specifies a set of functions that are available to an application programmer. It includes the parameters that are passed to each function and the return values the programmer can expect. Three most common APIs: Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 8 / 43

Application Programming Interface (API) The API specifies a set of functions that are available to an application programmer. It includes the parameters that are passed to each function and the return values the programmer can expect. Three most common APIs: POSIX API for Unix, Linux, and Mac OS X Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 8 / 43

Application Programming Interface (API) The API specifies a set of functions that are available to an application programmer. It includes the parameters that are passed to each function and the return values the programmer can expect. Three most common APIs: POSIX API for Unix, Linux, and Mac OS X Win32 API for Windows Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 8 / 43

Application Programming Interface (API) The API specifies a set of functions that are available to an application programmer. It includes the parameters that are passed to each function and the return values the programmer can expect. Three most common APIs: POSIX API for Unix, Linux, and Mac OS X Win32 API for Windows Java API for the Java virtual machine (JVM) Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 8 / 43

Example of Standard API > man read READ(2) Linux Programmers Manual READ(2) NAME read - read from a file descriptor SYNOPSIS #include <unistd.h> ssize_t read(int fd, void *buf, size_t count); DESCRIPTION read() attempts to read up to count bytes from file descriptor fd into the buffer starting at buf. If count is zero, read() returns zero and has no other results. If count is greater than SSIZE_MAX, the result is unspecified. RETURN VALUE On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number.... Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 9 / 43

Why would an application programmer prefer programming according to an API rather than invoking actual system calls? Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 10 / 43

API and System Calls > cp a.txt b.txt Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 11 / 43

API and System Calls > strace cp a.txt b.txt execve("/bin/cp", ["cp", "a.txt", "b.txt"], [/* 49 vars */]) = 0 brk(0) = 0x8a2d000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap2(null, 8192, PROT_READ PROT_WRITE, MAP_PRIVATE MAP_ANONYMOUS, -1, 0) = 0xb76ff000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY O_CLOEXEC) = 3 fstat64(3, {st_mode=s_ifreg 0644, st_size=108563,...}) = 0 mmap2(null, 108563, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb76e4000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/i386-linux-gnu/libselinux.so.1", O_RDONLY O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@A\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=s_ifreg 0644, st_size=120748,...}) = 0 mmap2(null, 125852, PROT_READ PROT_EXEC, MAP_PRIVATE MAP_DENYWRITE, 3, 0) = 0xb76c5000 mmap2(0xb76e2000, 8192, PROT_READ PROT_WRITE, MAP_PRIVATE MAP_FIXED MAP_DENYWRITE, 3, 0x1c) = 0xb76e2000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/i386-linux-gnu/librt.so.1", O_RDONLY O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\30\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=s_ifreg 0644, st_size=30684,...}) = 0 mmap2(null, 33360, PROT_READ PROT_EXEC, MAP_PRIVATE MAP_DENYWRITE, 3, 0) = 0xb76bc000 mmap2(0xb76c3000, 8192, PROT_READ PROT_WRITE, MAP_PRIVATE MAP_FIXED MAP_DENYWRITE, 3, 0x6) = 0xb76c3000 close(3) = 0... Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 12 / 43

System Call Interface The system call interface intercepts function calls in the API and invokes the necessary system calls within the OS. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 13 / 43

System Calls Implementation (1/2) Typically, a number associated with each system call. [http://www.rootkitanalytics.com/kernelland] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 14 / 43

System Calls Implementation (1/2) Typically, a number associated with each system call. System-call interface maintains a table indexed according to these numbers. [http://www.rootkitanalytics.com/kernelland] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 14 / 43

System Calls Implementation (1/2) Typically, a number associated with each system call. System-call interface maintains a table indexed according to these numbers. The system call interface invokes the intended system call in OS kernel and returns status of the system call and any return values. [http://www.rootkitanalytics.com/kernelland] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 14 / 43

System Calls Implementation (2/2) The caller does not need to know about the system call implementation. [http://www.rootkitanalytics.com/kernelland] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 15 / 43

System Calls Implementation (2/2) The caller does not need to know about the system call implementation. Just needs to obey API and understand what OS will do as a result call. [http://www.rootkitanalytics.com/kernelland] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 15 / 43

System Calls Implementation (2/2) The caller does not need to know about the system call implementation. Just needs to obey API and understand what OS will do as a result call. Most details of OS interface hidden from programmer by API. [http://www.rootkitanalytics.com/kernelland] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 15 / 43

System Call Parameter Passing (1/2) Three general methods used to pass parameters to the OS. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 16 / 43

System Call Parameter Passing (1/2) Three general methods used to pass parameters to the OS. 1 Pass the parameters in registers. In some cases, may be more parameters than registers. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 16 / 43

System Call Parameter Passing (1/2) Three general methods used to pass parameters to the OS. 1 Pass the parameters in registers. In some cases, may be more parameters than registers. 2 Parameters stored in a block or table, in memory, and address of block passed as a parameter in a register. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 16 / 43

System Call Parameter Passing (1/2) Three general methods used to pass parameters to the OS. 1 Pass the parameters in registers. In some cases, may be more parameters than registers. 2 Parameters stored in a block or table, in memory, and address of block passed as a parameter in a register. 3 Parameters pushed onto the stack by the program and popped off the stack by the OS. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 16 / 43

System Call Parameter Passing (2/2) [Passing of parameters as a table] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 17 / 43

Types of System Calls System calls can be grouped roughly into six major categories: 1 Process control 2 File manipulation 3 Device manipulation 4 Information maintenance 5 Communications 6 Protection Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 18 / 43

Process Control System Calls create process, terminate process Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 19 / 43

Process Control System Calls create process, terminate process end, abort Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 19 / 43

Process Control System Calls create process, terminate process end, abort load, execute Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 19 / 43

Process Control System Calls create process, terminate process end, abort load, execute get process attributes, set process attributes Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 19 / 43

Process Control System Calls create process, terminate process end, abort load, execute get process attributes, set process attributes wait for time Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 19 / 43

Process Control System Calls create process, terminate process end, abort load, execute get process attributes, set process attributes wait for time wait event, signal event Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 19 / 43

Process Control System Calls create process, terminate process end, abort load, execute get process attributes, set process attributes wait for time wait event, signal event allocate and free memory Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 19 / 43

File Management System Calls create file, delete file Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 20 / 43

File Management System Calls create file, delete file open, close Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 20 / 43

File Management System Calls create file, delete file open, close read, write, reposition Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 20 / 43

File Management System Calls create file, delete file open, close read, write, reposition get file attributes, set file attributes Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 20 / 43

Device Management System Calls request device, release device Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 21 / 43

Device Management System Calls request device, release device read, write, reposition Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 21 / 43

Device Management System Calls request device, release device read, write, reposition get device attributes, set device attributes Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 21 / 43

Information Management System Calls get/set time or date Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 22 / 43

Information Management System Calls get/set time or date get/set system data Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 22 / 43

Information Management System Calls get/set time or date get/set system data get/set process, file, or device attributes Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 22 / 43

Communications System Calls create, delete communication connection Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 23 / 43

Communications System Calls create, delete communication connection send, receive messages Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 23 / 43

Communications System Calls create, delete communication connection send, receive messages transfer status information Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 23 / 43

Communications System Calls create, delete communication connection send, receive messages transfer status information attach or detach remote devices Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 23 / 43

Operating System Architecture Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 24 / 43

Operating System Architecture (1/2) General-purpose OS is very large program. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 25 / 43

Operating System Architecture (1/2) General-purpose OS is very large program. A common approach is to partition the task into small components, rather than have one monolithic system. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 25 / 43

Operating System Architecture (1/2) General-purpose OS is very large program. A common approach is to partition the task into small components, rather than have one monolithic system. Each component should be a well-defined portion of the system, with carefully defined inputs, outputs, and functions. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 25 / 43

Operating System Architecture (2/2) Various ways to structure ones: Simple structure, e.g., MS-DOS More complex structure, e.g., Unix Layered, an abstraction Microkernel, e.g., Mach Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 26 / 43

Simple Structure Provide the most functionality in the least space. Not divided into modules. Its interfaces and levels of functionality are not well separated. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 27 / 43

More Complex Structure (1/2) the original Unix had limited structuring. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 28 / 43

More Complex Structure (1/2) the original Unix had limited structuring. The Unix consists of two separable parts: Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 28 / 43

More Complex Structure (1/2) the original Unix had limited structuring. The Unix consists of two separable parts: 1 Systems programs 2 The kernel Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 28 / 43

More Complex Structure (1/2) the original Unix had limited structuring. The Unix consists of two separable parts: 1 Systems programs 2 The kernel Everything below the system call interface and above the hardware. Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 28 / 43

More Complex Structure (2/2) [Traditional Unix system structure] Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 29 / 43

Layered Structure The operating system is divided into a number of layers. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 30 / 43

Layered Structure The operating system is divided into a number of layers. Each layer is built on top of lower layers. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 30 / 43

Layered Structure The operating system is divided into a number of layers. Each layer is built on top of lower layers. The bottom layer is the hardware. The highest layer is the user interface. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 30 / 43

Layered Structure The operating system is divided into a number of layers. Each layer is built on top of lower layers. The bottom layer is the hardware. The highest layer is the user interface. Layers are selected such that each uses functions and services of only lower-level layers. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 30 / 43

Microkernel Structure (1/2) Moves as much from the kernel into user space. Communication takes place between user modules using message passing. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 31 / 43

Microkernel Structure (2/2) Advantages: Easier to extend a microkernel. Easier to port the OS to new architectures. More reliable (less code is running in kernel mode). More secure. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 32 / 43

Microkernel Structure (2/2) Advantages: Easier to extend a microkernel. Easier to port the OS to new architectures. More reliable (less code is running in kernel mode). More secure. Disadvantages: Performance overhead of user space to kernel space communication. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 32 / 43

Modules Many modern operating systems implement loadable 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. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 33 / 43

Modules Many modern operating systems implement loadable 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,... Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 33 / 43

Hybrid Systems Most modern operating systems are actually not one pure model. Hybrid combines multiple approaches to address performance, security, usability needs. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 34 / 43

Hybrid Systems Most modern operating systems are actually not one pure model. Hybrid combines multiple approaches to address performance, security, usability needs. Linux and Solaris are monolithic, plus modular for dynamic loading of functionality. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 34 / 43

Hybrid Systems Most modern operating systems are actually not one pure model. Hybrid combines multiple approaches to address performance, security, usability needs. Linux and Solaris are monolithic, plus modular for dynamic loading of functionality. Windows mostly monolithic, plus microkernel for different subsystem personalities. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 34 / 43

Hybrid Systems Most modern operating systems are actually not one pure model. Hybrid combines multiple approaches to address performance, security, usability needs. Linux and Solaris are monolithic, plus modular for dynamic loading of functionality. Windows mostly monolithic, plus microkernel for different subsystem personalities. Apple Mac OS X kernel consists of Mach microkernel and BSD Unix parts, plus I/O kit and dynamically loadable modules Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 34 / 43

Operating System Design and Implementation Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 35 / 43

Operating System Design Goals The first problem in designing a system is to define goals and specifications. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 36 / 43

Operating System Design The design of the system will be affected by the choice of hardware and the type of system: batch time sharing single user/multiuser distributed real time... Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 37 / 43

Users Goals vs. System Goals User goals: OS should be convenient to use, easy to learn, reliable, safe, and fast. System goals: OS should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 38 / 43

How vs. What Separating policy from mechanism: Policy: what to do? Mechanism: how to do? Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 39 / 43

How vs. What Separating policy from mechanism: Policy: what to do? Mechanism: how to do? Mechanisms determine how to do something, policies decide what will be done. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 39 / 43

How vs. What Separating policy from mechanism: Policy: what to do? Mechanism: how to do? Mechanisms determine how to do something, policies decide what will be done. The separation of policy from mechanism allows maximum flexibility if policy decisions are to be changed later. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 39 / 43

Implementation Early OSes in assembly language. Then system programming languages like Algol, PL/1. Now C and C++. Actually usually a mix of languages: Lowest levels in assembly. Main body in C. Systems programs in C, C++, scripting languages, e.g., Python. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 40 / 43

Implementation Early OSes in assembly language. Then system programming languages like Algol, PL/1. Now C and C++. Actually usually a mix of languages: Lowest levels in assembly. Main body in C. Systems programs in C, C++, scripting languages, e.g., Python. More high-level language easier to port to other hardware, but slower. Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 40 / 43

Summary Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 41 / 43

Summary Operating-system structure: user-space, system calls, kernel-space Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 42 / 43

Summary Operating-system structure: user-space, system calls, kernel-space System calls: File manipulation Device manipulation Information maintenance Communications Protection Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 42 / 43

Summary Operating-system structure: user-space, system calls, kernel-space System calls: File manipulation Device manipulation Information maintenance Communications Protection Operating-system architecture: simple, layered, micro-kernel, hybrid Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 42 / 43

Questions? Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 43 / 43