340 likes | 458 Views
Introduction Computer System Structures Operating System Structures Processes Process Synchronization Deadlocks CPU Scheduling. Memory Management Virtual Memory File Management Security Networking Distributed Systems Case Studies Conclusions. Course Overview. Motivation Objectives
E N D
Introduction Computer System Structures Operating System Structures Processes Process Synchronization Deadlocks CPU Scheduling Memory Management Virtual Memory File Management Security Networking Distributed Systems Case Studies Conclusions Course Overview
Motivation Objectives OS Components OS Services System Calls System Programs OS Structure Kernel Virtual Machines Characteristics of Modern Operating Systems Important Concepts and Terms Chapter Summary Chapter OverviewOperating System Structures
Motivation • to understand the functioning of an operating system, it is important to have an overall view of it • many components can’t considered in isolation because they interact with and depend on each other • different design approaches are possible with different underlying hardware capabilities
Objectives • get to know the important components of an operating system • understand the interrelationships between the components • identify different approaches to the overall design of operating systems • be aware of current trends in operating system design
OS Components • process management • main memory management • secondary storage management • file management • I/O system management • networking • protection • user interface
OS Services • program execution • I/O operations • file and directory services • communication • error detection and handling • resource allocation • protection • accounting
Producing an Executable. Source Code Object File Executable Compile Link Libraries and other Object files [David Jones
System Calls • interface between processes and operating system • used to request services from the OS • provides operations on objects that processes can not or are not allowed to handle directly • used by programmers, not by users • types of system calls • process control • file manipulation • device manipulation • information maintenance • communications
System Calls Functions supplied by system libraries. These functions will contain a trap instruction. • #include <sys/types.h> • #include <dirent.h> • #include "ourhdr.h" • int main(int argc, char *argv[]) • { • DIR *dp; • struct dirent *dirp; • if (argc != 2) • err_quit("a single argument (the directory name) is required"); • if ( (dp = opendir(argv[1])) == NULL) • err_sys("can't open %s", argv[1]); • while ( (dirp = readdir(dp)) != NULL) • printf("%s\n", dirp->d_name); • closedir(dp); • exit(0); • } [David Jones]
Interrupt Handling User Mode User Program #2 1. Program performs trap 2. OS determines service number 3. Service is located and executed. 4. Control returns to user program. User Program #1 Main Memory trap 002 4 1 3 Based on a diagram from “Modern Operating Systems” by Andrew Tanenbaum. 2 System/Kernel Mode Kernel [David Jones]
System Programs • programs providing more convenient functions to utilize the system • directly accessible by the user • types of system programs • file manipulation and modification • programming environments • communication • status information • command interpreter
OS Structure • monolithic approach • the whole OS is one large program • often used under resource constraints (processing power, memory space) • example: PC DOS • layered approach • functionalities are grouped into layers from hardware to user programs • better separation of functions • example: OS
Kernel • core part of the operating system comprising the minimal set of functionalities • process dispatching • basic memory management • interprocess communication • protection • is always kept in main memory • porting is made easier
Virtual Machines • software abstraction by the OS • provides an interface identical to the corresponding hardware • emulates different hardware architectures on the same hardware • isolates users, programs, and processes from each other • example: Java Virtual Machine
Characteristics of Modern Operating Systems • microkernel architecture • multithreading • symmetric multiprocessing • distributed operating systems • object-oriented design
Microkernel Architecture • kernel contains only a few essential functions • address spaces, interprocess communication, basic scheduling • the kernel must be adapted to a specific hardware • server processes provide the remaining functionality in the form of services • services can be offered by local or remote server processes • flexible approach, especially for distributed systems • previous architectures: large, monolithic kernel includes most of the OS functionality
Multithreading • an application is executed by one or more processes • each process may be divided into threads • threads are the basic unit of work in an OS • threads are also known as lightweight processes • switching between threads is simpler than between processes • the general treatment of threads and processes by the OS is essentially the same • a thread shares resources with its peers • good for the modularity of applications • allows modules to execute largely independently
Symmetric Multiprocessing • provides more processing power through multiple processing elements • the processes share main memory and I/O devices • the processors are either identical, or can at least perform the same functions
Distributed Operating Systems • all resources within the distributed system are available to all processes if they have the right permissions • the execution of tasks can be distributed over several nodes • there is one single file system encompassing all files on all nodes
Object-Oriented Design • development method for modular systems • the interface of modules is independent of the actual implementation • internal details of modules are not accessible to others • goes well with the microkernel method and distributed systems
OS Design Goals • user perspective • convenient, responsive, easy to use, reliable, safe, fast • system perspective • efficient, flexible, reliable, easy to design, implement, and maintain • difficult task, requires many tradeoffs
CPU Main Memory Control Unit I/O Devices Registers Controllers Arithmetic Logic Unit (ALU) System Bus Microkernel OS Applications Operating System Micro-Kernel Hardware [David Jones
System Services Device Drivers File System CPU Main Memory Control Unit I/O Devices Registers Controllers Arithmetic Logic Unit (ALU) System Bus Microkernel OS Applications Server Processes Personalities Operating System Micro-Kernel Hardware [David Jones
System Services Device Drivers Personalities CPU Main Memory Control Unit I/O Devices Registers Controllers Arithmetic Logic Unit (ALU) System Bus Microkernel OS Microkernel OS Users and User Programs Applications Server Processes File System Operating System Micro-Kernel Hardware [David Jones
System Services Device Drivers Personalities Micro- Kernel Micro- Kernel Micro- Kernel Micro- Kernel Micro- Kernel Micro- Kernel Computer Node Computer Node Computer Node Computer Node Computer Node Computer Node Distributed OS Users and User Programs Applications Server Processes File System Operating System Hardware [David Jones
Future Operating Systems • micro-kernel based • multiple personalities • emulate appearance and functionality of existing OSes • distributed systems
OS Structure Examples • MS-DOS & Windows • Windows NT • Unix
MS-DOS & Windows Structure • originally (DOS 1) monolithic due to space and processing power restrictions (Intel 8086, 8 KBytes main memory) • slow incorporation of advanced concepts • hard disk, hierarchical file systems, I/O redirection, background printing, networking, ... • fresh start with Windows NT • single-user, multitasking • designed for 32-bit microprocessors (Intel Pentium)
Windows NT Structure • hardware abstraction layer (HAL) • provides adaptation to the underlying hardware through a generic hardware interface • microkernel • thread scheduling, process switching, exception handling (interrupts), multiprocessor synchronization • executive services • modules for system functions • I/O manager, object manager, process manager, virtual memory manager, security reference monitor, windows modules • system services • interface to software running in user mode
POSIX Subsystem Win32 Subsystem OS/2 Subsystem Security Subsystem Local Procedure Call Facility Security Reference Monitor Virtual Memory Manager I/O Manager Object Manager Process Manager Window Manager Cache Manager File System Drivers Graphic Device Drivers Micro-Kernel Network Drivers Hardware Abstraction Layer (HAL) Device Drivers Hardware Windows NT Structure Microkernel OS Users and User Programs Applications and User Interface System Services Windows NT Executive [Stallings 98]
Unix Structure • single processor, multi-user, multitasking system • portable through implementation in a high-level language (C), in contrast to assembly language • relatively large, non-modular kernel • access to kernel functions through system calls • shells as user interface, GUI (XWindows) added later • modern Unix variants have been redesigned around microkernel
Modern Unix Kernel elf a.out exec switch file mappings NFS device mappings virtual memory framework vnode/vfs interface FFS RFS anonymous mappings Common Facilities time-sharing processes block device switch scheduler framework disk driver system processes tape driver Streams network driver tty driver [Stallings 98]
Important Concepts and Terms • command interpreter • communication • device management • directory system • distributed system • file system • interrupt • kernel • layered structure • memory management • microkernel • monolithic structure • multiprocessing • multiprogramming • multitasking • operating system • process • process control block (PCB) • process management • protection • resource allocation • secondary storage management • shell • system call • system program • task • thread • time-sharing • user interface • virtual machine
Chapter Summary • the operating system provides services and manages resources • user processes request services from the OS through system calls • protection, resource management, abstraction • modern operating systems separate functions into modules • layered approach, microkernel, object-oriented, virtual machine