Operating Systems Structure

Slides:



Advertisements
Similar presentations
Interactive lesson about operating system
Advertisements

Processes Management.
Operating System Structures
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Common System Components
Lecture 1: Introduction CS170 Spring 2015 Chapter 1, the text book. T. Yang.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
General Information Class time (NC 441)
Chapter 1: Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts What is an Operating System? A program that acts as an intermediary.
Process Management A process is a program in execution. It is a unit of work within the system. Program is a passive entity, process is an active entity.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
3.1 Operating System Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
Processes Introduction to Operating Systems: Module 3.
Operating Systems Structure what is the organizational principle?
1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Caching Important principle, performed at many levels in a computer (in.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Lecture Topics: 10/29 Architectural support for operating systems –timers –kernel mode –system calls –protected instructions.
Chapter 1. Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 12, 2005 Introduction Introduction What.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 2: OS Structures (Chapter 2.7)
CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition System Programs (p73) System programs provide a convenient environment.
Operating System (Reference : OS[Silberschatz] + Norton 6e book slides)
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Chapter 1: Introduction Narzu Tarannum(NAT) Reff: BIS.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 1: Introduction.
1.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 1: Introduction What Operating Systems Do √ Computer-System Organization.
Chapter 1: Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives To provide a grand tour of the major operating.
CSCE451/851 Introduction to Operating Systems
Introduction to Operating Systems Concepts
Computer System Structures
Chapter 2: Operating-System Structures
Module 3: Operating-System Structures
Operating System Structures
Chapter 2: Computer-System Structures
Processes and threads.
Chapter 1: Introduction
Operating System Structure
Chapter 1: Introduction
Chapter 2: Operating-System Structures
Introduction To OS (OS Structure, Modes and Services)
Chapter 2: System Structures
Chapter 3: Operating-System Structures
Computer-System Architecture
Module 2: Computer-System Structures
Chapter 1 Introduction to Operating System Part 5
Chapter 1 Introduction to Operating System
Architectural Support for OS
Chapter 2: Operating-System Structures
Outline Chapter 2 (cont) OS Design OS structure
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Module 2: Computer-System Structures
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
Chapter 1: Introduction
CSE 451: Operating Systems Winter 2007 Module 2 Architectural Support for Operating Systems Brian Bershad 562 Allen Center 1.
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
System calls….. C-program->POSIX call
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 2: Operating-System Structures
Module 2: Computer-System Structures
III. Operating System Structures
Presentation transcript:

Operating Systems Structure Operating Systems 2019 Spring by Euiseong Seo

Arch-dependent kernel code OS Internals User Application C Library (libc) User space Kernel Arch-dependent kernel code System Call Interface Kernel space Hardware Platform

Hardware Control (Interrupt handling, etc.) OS Internals shell shell ps ls User space trap Kernel space System Call Interface File System Management Memory Management Process Management Protection scheduler IPC I/O Management (device drivers) synchronization Hardware Control (Interrupt handling, etc.) Hardware

System Call Interface

Protected Instructions Protected or privileged instructions Direct I/O access Use privileged instructions or memory-mapping Memory state management Page table updates, page table pointers TLB loads, etc. Setting special “mode bits” Halt instruction

OS Protection How does the processor know if a protected instruction should be executed? The architecture must support at least two modes of operation: kernel and user mode 4 privilege levels in IA-32: Ring 0 > 1 > 2 > 3 Mode is set by a status bit in a protected processor register User programs in user mode, OS in kernel mode Current Privilege Level (CPL) in IA-32: CS register Protected instructions can only be executed in the kernel mode

OS Protection Crossing protection boundaries User programs must call an OS to do something privileged. OS defines a sequence of system calls There must be a system call instruction that: causes an exception, which invokes a kernel handler passes a parameter indicating which system call to invoke saves caller’s state (registers, mode bits) so they can be restored OS must verify caller’s parameters (e.g. pointers) must provide a way to return to user mode when done. (cf.) INT 0x80 in Linux

OS Protection Making a system call System call changes mode to kernel Return from system call resets it to user

OS Operation OS is basically interrupt-driven Hardware interrupt Timer I/O Software interrupt System call Exception

Multiprogramming Batch system Multiprogramming needed for efficiency Job must wait for the preceding job to finish One by one Multiprogramming needed for efficiency Single user cannot keep CPU and I/O devices busy at all times Multiprogramming organizes jobs (code and data) so CPU always has one to execute A subset of total jobs in system is kept in memory One job selected and run via job scheduling When it has to wait (for I/O for example), OS switches to another job Timesharing (multitasking) CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing Response time should be < 1 second

Memory Protection Requirements OS must protect user programs from each other Malicious users OS must also protect itself from user programs Integrity and security

Memory Protection Simplest scheme Use base and limit registers Base and limit registers are loaded by OS before starting a program Prog A base reg Prog B limit reg Prog C

Memory Protection MMU (memory management unit) Memory management hardware provides more sophisticated memory protection mechanisms Base and limit registers page table pointers, page protection, TLBs virtual memory segmentation Manipulation of memory management hardware are protected (privileged) operations

Process Management A process is a program in execution Program is a passive entity Process is an active entity Process needs resources to accomplish its task Process termination requires reclaim of any reusable resources Single-threaded process has one program counter specifying location of next instruction to execute Multi-threaded process has one program counter per thread Typically system has many processes, some user, some operating system running concurrently on one or more CPUs

Synchronization Problems Synchronization Interrupt can occur at any time and may interfere with interrupted code OS must be able to synchronize concurrent processes Synchronization Turn off/on interrupts Use a special atomic instructions read-modify-write (e.g., INC, DEC) test-and-set LOCK prefix in IA32 LL (Load Locked) & SC (Store Conditional) in MIPS

I/O Subsystems One purpose of OS is to hide peculiarities of hardware devices from the user General device-driver interface Drivers for specific hardware devices I/O subsystem includes Buffering (storing data temporarily while it is being transferred) Caching (storing parts of data in faster storage for performance) Spooling (the overlapping of output of one job with input of other jobs)

Storage Management

Storage Management OS provides uniform, logical view of information storage Abstracts physical properties to logical storage unit - file Each medium is controlled by device (i.e., disk drive, tape drive) Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random) File-System management Files usually organized into directories Access control on most systems to determine who can access what OS activities include Creating and deleting files and directories Primitives to manipulate files and directories Mapping files onto secondary storage Backup files onto stable (non-volatile) storage media

OS Design and Implementation Design and Implementation of OS not “solvable” Some approaches have proven successful Internal structure of different OSs can vary widely Start design by defining goals and specifications Affected by choice of hardware, type of system User goals and System 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

OS Design and Implementation 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 Separation of policy from mechanism Allows maximum flexibility if policy decisions are to be changed later Specifying and designing an OS is highly creative task of software engineering

Operating System Structures MS-DOS – written to provide the most functionality in the least space Not divided into modules Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated

Operating System Structures UNIX System

Layered Approach The operating system is divided into a number of layers Each built on top of lower layers Bottom layer is hardware Highest is user interface With modularity, layers are selected such that each uses functions (operations) and services of only lower- level layers

Microkernel VS Monolithic Kernel Moves as much from the kernel into user space Mach example of microkernel Mac OS X kernel (Darwin) partly based on Mach Communication takes place between user modules 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

Microkernel System Structure

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, etc

Module Approach in Solaris

Mac OS X