1 Lecture 3: OS Functions and Design Approaches  OS duties process management memory management disk/file management protection & security  interaction.

Slides:



Advertisements
Similar presentations
OS Components and Structure
Advertisements

Operating System Structures
Chap 2 System Structures.
Operating System Structure
Operating-System Structures
3: OS Structures 1 OPERATING SYSTEM STRUCTURES PROCESS MANAGEMENT A process is a program in execution: (A program is passive, a process active.) A process.
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
1/21/2008CSCI 315 Operating Systems Design1 Operating System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 2: Operating-System Structures
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
2: OS Structures 1 Jerry Breecher OPERATING SYSTEMS STRUCTURES.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Cs238 Lecture 3 Operating System Structures Dr. Alan R. Davis.
Common System Components
1 Gary Kimura Lecture #3 October 4, 2002 CSE451 Operating Systems Components and Basic Organization Autumn 2002.
Os31 Chapter 3 Operating-System Structures. os32 Outlines System Components Operating System Services System Calls System Programs System Structure Virtual.
Lecture 1: Introduction CS170 Spring 2015 Chapter 1, the text book. T. Yang.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System.
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
Abhinav Kamra Computer Science, Columbia University 3.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 3: Operating-System Structures.
System Components Operating System Services System Calls System Programs System Structure Virtual Machines System Design and Implementation System Generation.
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
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.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
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.
OS, , Part I Operating - System Structures Department of Computer Engineering, PSUWannarat Suntiamorntut.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
Chapter 2. System Structures
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
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)
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Overview of today’s lecture Major components of an operating system Structure and internal architecture of an operating system Monolithic Vs Micro-kernels.
Introduction to Operating Systems Concepts
Computer System Structures
Computer System Structures
Module 3: Operating-System Structures
Chapter 1: Introduction
Operating System Structure
Chapter 2: System Structures
Chapter 3: Operating-System Structures
Basic Concepts Protection: Security:
Chapter 2: Operating-System Structures
Outline Chapter 2 (cont) OS Design OS structure
OS Components and Structure
Outline Operating System Organization Operating System Examples
OPERATING SYSTEMS STRUCTURES
System calls….. C-program->POSIX call
Chapter 2: Operating-System Structures
Operating Systems Structure
CSE 451: Operating Systems Winter 2006 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
Presentation transcript:

1 Lecture 3: OS Functions and Design Approaches  OS duties process management memory management disk/file management protection & security  interaction with OS dual-mode operation system calls API, system programs, UI  OS design approaches: monolithic kernel microkernel virtual machine

2 Process Management  OS manages many kinds of activities: user programs system programs: printer spoolers, name servers, file servers, etc.  a running program is called a process a process includes the complete execution context (code, data, PC, registers, OS resources in use, etc.) a process is not a program F program - a sequence of instructions (passive) F process - one instance of a program in execution (active); many processes can be running the same program and one program may cause to create multiple processes  from OS viewpoint process is a unit of work; OS must: create, delete, suspend, resume, and schedule processes support inter-process communication and synchronization, handle deadlocks

3 Memory Management  primary (main) memory (RAM) provides direct access storage for CPU processes must be in main memory to execute  OS must: mechanics F keep track of memory in use F keep track of unused (“free”) memory F protect memory space F allocate, deallocate space for processes F swap processes: memory  disk policies F decide when to load each process into memory F decide how much memory space to allocate to each process F decide when a process should be removed from memory

4 Disk Management  the size of the disk is much greater than main memory and, unlike main memory, disk is persistent (survives system failures and power outages)  OS hides peculiarities of disk usage by managing disk space at low level: keeps track of used spaces keeps track of unused (free) space keeps track of “bad blocks”  OS handles low-level disk functions, such as: schedules of disk operations and head movement

5 File Management  disks provide long-term storage, but are awkward to use directly  file - a logical named persistent collection of data maintained by OS  file system - a logical structure that that is maintained by OS to simplify file manipulation; usually directory based  OS must: create and delete files and directories manipulate files and directories - read, write, extend, rename, copy, protect provide general higher-level services - backups, accounting, quotas  note the difference between disk management and file system management

6 Protection & Security  protection – any mechanism for controlling access of processes or users to resources disk, memory, CPU,  security – defense of the system against internal and external attacks systems generally first distinguish among users, to determine who can do what F user identities and privileges associated with this identifier F user ID then associated with all files, processes of that user to determine access control

7 Dual-Mode Operation  to allow protection OS operates in dual-mode  user mode and kernel mode  mode bit provided by hardware user (1), kernel (0) enables OS to distinguish when system is running user code or kernel code  some instructions designated as privileged, only executable in kernel mode changing modes modifying timers modifying interrupt service routines I/O device access

8 System Call Definition  app. program can ask the OS to carry out service for it by invoking a system call to the application the invocation is similar to an ordinary function call example: Unix write system call description prompt% man -S 2 write WRITE(2) Linux Programmer's Manual WRITE(2) NAME write - write to a file descriptor SYNOPSIS #include ssize_t write(int fd, const void *buf, size_t count); DESCRIPTION write() writes up to count bytes to the file referenced by the file descriptor fd from the buffer starting at buf. … RETURN VALUE On success, the number of bytes written are returned …

9 Mode Switch  mode switch – transition from user to kernel mode  system call generates a trap (software generated interrupt)  physical interrupt occurs (e.g. a timer interrupt)  control is transferred to the interrupt service routine, which may pass control to the OS (in kernel mode) return it back to the user process  in case OS needs to do extensive work, it needs to save the context (state) of the user program

10 Function Invocation Trace Across Modes  Example function invocation in Solaris (Unix-like OS from Sun Microsystems) node the mode (User or Kernel) for function invocation

11 System Call Example  a typical app. program invokes system calls repeatedly  example: copying a file

12 Application Program Interface  “raw” system calls tend to be difficult to use  application program interface (API) defines functions that are more convenient to use  API functions can be invoked by app. programmer run in user mode directly invoke system calls implemented in system libraries that come with the OS and are linked to the app. program  API examples: POSIX API (implemented by most Unix systems, MacOS X), Java API, Win 32 API – windows ex: printf (C function that prints formatted output, part of POSIX API) repeatedly invokes write

13 System Programs and UIs  system programs come with the OS they are designed for end users – the person for whom the computer/OS/app. programs are designed F cf. application programmers, OS programmers operate in user mode typical tasks: file manipulation, status info, file modification (editors), programming language support (compilers/assemblers), configuration, communication, etc.  user interface (UI) is a way the end-user interacts with system programs (and through them with the OS), F command-line interface (CLI) – interaction through command interpreter (shell) – a text-based system program F graphical-user interface (GUI) – mouse-heavy with a lot of graphics most popular OSes support both kinds of UI

14 Monolithic Kernel OS Design  advantages: speed and ease of operation (everything is at hand)  disadvantages: hard to develop, maintain, modify and debug kernel gets bigger as the OS develops critical OS data structures and device registers are protected from user programs system processes system calls user processes device controllers signals terminals character I/O files swapping disk, tape CPU scheduling page replacement virtual memory terminal drivers device drivers memory drivers kernel machine- independent machine - dependent hardware app. processes commands/interrupts kernel mode user mode

15 Modular Kernel  classic monolithic kernel requires all functionality to be inbuilt into kernel and loaded at boot-time – waste of RAM, limited flexibility  loadable kernel module – object file to be loaded at boot time or, possibly compile time extends base kernel functionality, common functions of kernel modules F device drivers/bus drivers, filesystems, system calls, CPU scheduling classes, executable file formats loaded to kernel address space has full access to all kernel memory has defined programming interface, possibly protected  Linuxes, Windows, Solaris, Mac OS X support kernel modules

16 Microkernel  advantages: reliability, ease of development, modularity - parts can be replaced and tailored to the architecture, user requirements etc.  disadvantages: slow?  examples: MacOS X, Windows XP small kernel implements communication (usually messages) when system services are required microkernell calls other parts of OS running in user modes and passes the request there user processes file system CPU scheduling thread system network support paging system processes micro- kernel user mode kernel mode communication protection low-level VM processor control device controllers hardware commands/interrupts

17 Virtual Machine  OS’s system calls are considered an enhancement of hardware’s instruction set extend further – virtual machine  each user task is provided with an abstract (virtual machine) which OS + hardware implement IBM – pioneered modern examples: F Java VM – next slide F VMware Player – extra guest/host bit, guest OS executes limited set of instructions, if different instruction – trap to host OS adv. – portability at binary-level, security, greater language flexibility dis. – speed(?)

18 Java Virtual Machine (JVM)  Java source code is translated into an architecture independent java bytecode  bytecode is executed by JVM  JVM can be implemented purely in software or in hardware  JVM verifies bytecode’s correctness and then either interprets (translates the code into machines instructions one by one)  or just-in-time (JIT) compiles to optimize, or both adv. – portability at binary-level, security, greater language flexibility dis. – speed(?)

19 Lecture Review  major OS duties are process management memory management disk/file management  OS interacts with users through system calls, to ease interaction API - for app. programmers GUI or CLI for end-users  OS is a big and complex program; traditional monolithic kernel design approach yields OSes that are fast but hard to develop, modify and debug; other approaches have been suggested: microkernel virtual machine

20 Future: network computers?  JavaOS no disk OS is only capable of running Java Virtual Machine all the programs (including OS components) are downloaded over the network advantages: ease of administration and rollout (installation), platform independence disadvantages: ??

21 Monolithic Kernel OS Design  advantages: speed and ease of operation (everything is at hand)  disadvantages: hard to develop, maintain, modify and debug kernel gets bigger as the OS develops critical OS data structures and device registers are protected from user programs can use privileged instructions system services: shells, compilers, printing, network access system calls user programs hardware: terminals, I/O devices, memory signals terminals character I/O files swapping disk, tape CPU scheduling page replacement virtual memory terminal controllers device controllers memory controllers kernel machine- independent machine - dependent

22 Layered Design  divide OS into layers  each layer uses services provided by next lower layer yet the implementation of these services are hidden from the upper layer  THE Operating system layer structure: user programs buffering for input and output devices operator-console device driver memory management CPU scheduling hardware  advantages: easier development and implementation  disadvantages: not always easy to break down on layers, slower (each level adds overhead) ex: CPU scheduler is lower than virtual memory driver (driver may need to wait for I/O) yet the scheduler may have more info than can fit in memory  examples: THE, OS/2