* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Operating Systems - Bina – Advanced Software Services
Library (computing) wikipedia , lookup
Plan 9 from Bell Labs wikipedia , lookup
Mobile operating system wikipedia , lookup
Security-focused operating system wikipedia , lookup
Copland (operating system) wikipedia , lookup
Burroughs MCP wikipedia , lookup
Distributed operating system wikipedia , lookup
Spring (operating system) wikipedia , lookup
Process management (computing) wikipedia , lookup
Operating Systems University of Haifa Extension Division Introduction 1 Administration Lecturer – • Aspis Ofir [email protected] Course Home Page – • Yet to come… Introduction 2 Administration Text Books : • Applied Operating System Concepts – • • • Silberschatz/Galvin/Gagne http://www.bell-labs.com/topic/books/aos-book Modern Operating Systems – Tanenbaum Linux Programming – Stones/Matthew Advanced Windows – Richter Introduction 3 What is Operating System ? A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals: • A program that controls the execution of • • application programs Make the computer system convenient to use. Use the computer hardware in an efficient manner. Introduction 4 Computer System Components 1. Hardware – provides basic computing resources (CPU, memory, I/O devices). 2. Operating system – controls and coordinates the use of the hardware among the various application programs for the various users. 3. Applications programs – define the ways in which the system resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs). 4. Users (people, machines, other computers). Introduction 5 Abstract View of System Components Introduction 6 Operating System Definitions Resource allocator – manages and allocates resources. Control program – controls the execution of user programs and operations of I/O devices . Kernel – the one program running at all times (all else being application programs). Introduction 7 User-Services Provided by the Operating System Program creation Program execution Access to I/O devices Controlled access to files • Editor and debugger utility programs • Loading instructions, initializing I/O devices • Making it a simple R/W command • Media technology, file format, controlling access Introduction 8 User-Services Provided by the Operating System Error detection and response • internal and external hardware errors • memory error • device failure • software errors • arithmetic overflow • access forbidden memory locations Introduction 9 Operating System as a resource manager It is actually a program that is executed by the processor to control the processor! Directs the processor in the use of system resources Directs the processor when executing other programs Processor stops executing the operating system in order to execute other programs and, then, gives the control back to the operating system Introduction 10 Operating System as a resource manager Memory management is decided by the operating system and memory management hardware in the processor. The operating system decides about the access of programs and files to I/O devices. In case of multiple processors, it decides for them all Introduction 11 A bit of history The First Generation (1945-55) – Vacuum Tubes and Plugboards Introduction 12 History (ctd.) The Second Generation (1955-65) Transistors and Batch Systems • • Using FORTRAN and assembly language OS – FMS , IBSYS (for IBM7094) Introduction 13 History (ctd.) The Third Generation (1965-1980) – Multiprogramming and Spooling The Primary development : PDPs computer and UNIX os • • Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them. Spooling - While executing one job, the OS: • • • Reads next job from card reader into a storage area on the disk (job queue). Outputs printout of previous job from disk to printer. Job pool – data structure that allows the OS to select which job to run next in order to increase CPU utilization. Introduction 14 OS Features Needed for Multiprogramming I/O routine supplied by the system. Memory management – the system must allocate the memory to several jobs. CPU scheduling – the system must choose among several jobs ready to run. Introduction 15 Example JOB1 Type of job Duration Memory required Need disk? Need terminal Need printer? JOB2 Heavy compute Heavy I/O 5 min. 15 min. 50K 100 K No No No Yes No No Introduction JOB3 Heavy I/O 10 min. 80 K Yes No Yes 16 Effects of Multiprogramming Processor use Memory use Disk use Printer use Elapsed time Throughput rate Mean response time • Uniprogramming Multiprogramming 17% 30% 33% 33% 30 min. 6 jobs/hr 18 min. 33% 67% 67% 67% 15 min. 12 jobs/hr 10 min. The secret is the supporting hardware for I/O interrupts and DMA Introduction 17 Time sharing advantages Using multiprogramming (multi-tasking) to handle multiple interactive jobs Processor’s time is shared among multiple users Multiple users simultaneously access the system through terminals The objective is to minimize response time to the user commands Introduction 18 History (cont.) The Fourth Generation(1980 – Present) – Personal Computers • Personal computers – computer system dedicated to a single user. • I/O devices – keyboards, mice, display screens, small printers. • User convenience and responsiveness. • Can adopt technology developed for larger operating system’ often individuals have sole use of computer and do not need advanced CPU utilization of protection features Introduction 19 Windows - History •DOS 1.00: 4000 lines of assembly language Introduction 20 Windows - History DOS 2.0 in 1983, supported a hard disk, one directory, max 64 files DOS 3.0 ran on Intel’s 286 processor, memory protection features and hard disk DOS 3.1, 1984, supported networking DOS 3.3, 1987, supported 386 processor Windows 3.0, 1990, PC Graphical User Interface (GUI) for the 1st time Introduction 21 Windows - History Windows NT developed from scratch to provide a multitasking single user environment. Version 3.1, 1993. Windows 95-98 : Multitasking single user – not full 32bit Win NT 4.0, 1996 – win95 GUI 16 million lines of C code Introduction 22 Characteristics of Modern Operating Systems 1. Microkernel architecture • Assigns only a few essential functions to the kernel • address space • interprocess communication (IPC) • basic scheduling • Other functions run in user mode and treated like any other application Introduction 23 Characteristics of Modern Operating Systems 2. Multithreading • process is divided into threads that can run • simultaneously Thread • dispatchable unit of work • executes sequentially and is interruptable • Process is a collection of one or more threads • Useful when there is no need to serialize, e.g., database that deals with several clients Introduction 24 Characteristics of Modern Operating Systems 3. Symmetric multiprocessing • • • • there are multiple processors transparent to the user these processors share same main memory and I/O facilities All processors can perform the same functions Better performance (speed), availability (fault tolerance), growth, scaling (wide price range) Introduction 25 Multiprogramming vs. multiprocessing Introduction 26 Operating Systems Concepts 1. 2. 3. 4. 5. Process Memory management Information protection & security Scheduling and resource management The Shell Introduction 27 Process • • • • • • • A process consists of 3 components: an executable program associated data execution context (PC, registers & status) Improper synchronization Status ensures that a process waiting for an I/O device receives the signal Failed mutual exclusion Priorities are included in context Nondeterminate program operation program should only depend on its input, not relying on common memory or order of running with others Deadlocks 2 or more programs awaiting each others! More later Introduction 28 Memory Management principals Process isolation Automatic allocation and management Supporting long-term means of storage achieves all of the above thru virtual memory and file system Introduction 29 Categories of Security and Protection Access control • regulate user access to the system and data, e.g., permissions Information flow control • regulate flow of data within the system and its delivery to users Certification • proving that access and flow control perform according to specifications, e.g., passwords Introduction 30 Scheduling and Resource Management Fairness • give equal and fair access to all processes that are charged the same rate Differential responsiveness Efficiency • discriminate between different classes of jobs • maximize throughput, minimize response time, and accommodate as many users as possible Operations-research management problems Introduction 31 Major elements of OS Short-term: In memory, ready to run on the CPU Operating System Service Call from Process Scheduler picks one OS moves jobs from long-term to short-term queues without overcommitting memory or Interrupt from Process processor Interrupt from I/O Service Call Handler Interrupt Handler Long- Short- I/O Term Term Queues Queue Queue Short-Term Scheduler I/O Queue for each I/O device OS also decides assigning Processes to IO devices Pass Control to Process An interrupt or a service call invokes scheduler to pick a Process for execution Introduction 32 System Calls System calls provide the interface between a running program and the operating system. • • Generally available as assembly-language instructions. Languages defined to replace assembly language for systems programming allow system calls to be made directly (e.g. from C,C++ , or Perl programs) Three general methods are used to pass parameters between a running program and the operating system. • • • Pass parameters in registers. Store the parameters in a table in memory, and the table address is passed as a parameter in a register. Push (store) the parameters onto the stack by the program, and pop off the stack by operating system. Introduction 33 Passing of Parameters As A Table Introduction 34 Passing of Parameters by the Stack 6 4 User space Kernel space (OS) Procedure Trap to the kernel 11 Increment SP 10 5 Put code for read in register Call Read 3 Push fd 2 Push &buffer 1 Library Return to caller 1 read User program Calling read Push nbytes 9 Dispatch 7 8 Introduction Sys call handler 35 Some Major POSIX system calls Process management Call Description pid = fork() Create a child process identical to the parent pid = waitpid(pid,&statloc,options) Wait for a child to terminate s = execve(name,argv,environp) Replace a process exit(status) Terminate process execution and return status Introduction 36 Some Major POSIX system calls File management Call Description fd = open(file,how,…) Open a file for read/write s = close(fd) Close an open file n = read(fd,buffer,nbytes) Read data from a file into a buffer n = write(fd,buffer,nbytes) Write data from a buffer into a file Introduction 37 System Calls for Process Management Example: UNIX/LINUX(POSIX) while(1) { type_prompt(); read_command(command,parameters); if(fork()!=0){ /*Parent code. */ waitepid(-1,&status,0); }else{ /*Child code */ execve(command,parameters,0); } } Introduction 38 Same Example in Win32 #include <stdio.h> #include <process.h> #include <windows.h> void main() { char s[80]; STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); while(1){ printf("Shell: "); gets(s); if(!CreateProcess(NULL,s,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) fprintf(stderr, "CreateProcess failed." ); } /* // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); */ 39 Introduction } Process Segments Stack FFFF Gap Data Text 0000 Introduction 40 MS-DOS Execution Introduction 41 UNIX Running Multiple Programs Introduction 42 System Structure – Simple Approach MS-DOS – written to provide the most functionality in the least space Introduction 43 System Structure – UNIX UNIX – The kernel • Consists of • everything below the system-call interface and above the physical hardware Provides the file system, CPU scheduling, memory management, and other operatingsystem functions. Introduction 44 Windows NT Kernel mode only has access to System data and hardware Modular flexible structure. Introduction 45 Virtual Machines A virtual machine provides an interface identical to the underlying bare hardware. The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory.. Introduction 46 The Java Virtual Machine Introduction 47 The operating System Zoo Mainframe Operating Systems – • High-End Servers • Processes routine jobs without any interactive user • present OS/390 for example Server Operating Systems • Run on Large PC or even on Mainframes • Print , file or web services • Unix , Windows 2000 , Linux Introduction 48 The operating System Zoo Multiprocessor Operating Systems PC Operating Systems Real-Time Operating Systems • Windows 2000 (up to 32 CPUs) , SunOS • Running users applications • Multimedia support • Windows 98/Me/Xp • Time as a key parameter (hard dead line) • VxWorks , QNX Introduction 49 The operating System Zoo Embedded Operating Systems • Run on a computer not generally thought of as • • computer, like TV ,microwave etc. Have some characteristics of real-time systems PalmOS , Windows CE Smart Card Operating Systems • Very small - run on a credit card sized device • Some are Java Oriented (based on JVM) Introduction 50