Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems (CSCI2413) Lecture 2 Overview phones off (please)

Similar presentations

Presentation on theme: "Operating Systems (CSCI2413) Lecture 2 Overview phones off (please)"— Presentation transcript:

1 Operating Systems (CSCI2413) Lecture 2 Overview phones off (please)

2 © De Montfort University, 2004CSCI2413 - L22 Operating-System Roles Resource management Operating System Services System Calls Kernel Virtual Memory

3 © De Montfort University, 2004CSCI2413 - L23 Resource Management Process Management Memory Management File Management I/O Management Secondary Management Protection Command-Interpreter

4 © De Montfort University, 2004CSCI2413 - L24 Hardware Resources CPUMain Memory File Store I/O Devices O.S. User Interface Process Management Memory Management File Management I/O Management Application Program User

5 © De Montfort University, 2004CSCI2413 - L25 Process Management A process is a program in execution. A process requires the CPU time, memory, files, and I/O devices, to accomplish its task. OS is responsible for: –Process creation and deletion. –process suspension and resumption. –Provision of mechanisms for: process synchronization process communication

6 © De Montfort University, 2004CSCI2413 - L26 Memory Management Memory is a repository of quickly accessible data shared by the CPU and I/O devices. OS is responsible for: –Keeping track of which parts of memory are currently being used and by whom. –Deciding which processes to load when memory space becomes available. –Allocating and de-allocating memory space as needed.

7 © De Montfort University, 2004CSCI2413 - L27 File Management A files represent programs (both source and object codes) and data. OS is responsible for: –File creation and deletion. –Directory creation and deletion. –Manipulating files and directories. –Mapping files onto secondary storage. –File backup on stable (nonvolatile) storage media.

8 © De Montfort University, 2004CSCI2413 - L28 I/O Management The I/O system consists of: –A buffer-caching system –A general device-driver interface –Drivers for specific hardware devices

9 © De Montfort University, 2004CSCI2413 - L29 Secondary-Storage Management Generally, disks are used for both programs and data. OS is responsible for: –Free space management –Storage allocation –Disk scheduling

10 © De Montfort University, 2004CSCI2413 - L210 Protection A mechanism for controlling access by programs, processes, or users to both system and user resources. Protection must: –Distinguish between authorised and unauthorised usage –Specify the controls to be imposed. –Provide a means of enforcing the control.

11 © De Montfort University, 2004CSCI2413 - L211 Command Interpreter Commands are given to the OS by control statements which mainly deal with: –Resource management, as explained above The program that reads and interprets control statements is variously called: –Command-line-interpreter –Shell (in UNIX). Its function is to get and execute the next command.

12 © De Montfort University, 2004CSCI2413 - L212 Services Program Execution – load a program into memory and run it I/O operations – OS is responsible for performing I/O operations. File Manipulation – capability to create, read, write, and delete files. Communications – Exchange of information between processes executing either on the same computer or on a distant computer connected via network.

13 © De Montfort University, 2004CSCI2413 - L213 Services (cont..) Error detection – detecting errors in the CPU and memory, in I/O devices, or in user program

14 © De Montfort University, 2004CSCI2413 - L214 System Calls An interface between a running program and the operating system. In another word, the means by which a process requests a specific kernel service.

15 © De Montfort University, 2004CSCI2413 - L215 Hardware Resources CPUMain Memory Disk, terminal Network interface Response to many system calls from processes Kernel Traps and faults Virtual memory InterruptsNetwork Processes User

16 © De Montfort University, 2004CSCI2413 - L216 Virtual Memory Virtual memory enables a computer to appear to have more memory than its real physical memory –the technique is employed by all modern OS’s All computers have more hard disk space than real physical memory (RAM) –hard disk space is used as ‘imaginary’ RAM When a process starts, rather than loading the whole program into memory, the supervisor loads instructions and data into RAM in small blocks –these memory blocks are called pages modern page sizes are typically 2K or 4K bytes

17 © De Montfort University, 2004CSCI2413 - L217 Virtual Memory I llustration main memory supervisor task process 3 (page 1) process 2 process 1 hard disk program 1 program 2 program 3 main memory supervisor task process 3 (page 1) process 1 process 3 (page 2) there is not enough free space in memory for all of program 3 so, initially, only page 1 is loaded in (note process 1 is still writing to hard disk in the background) process 3, page 2 is now required, so process 2 has been swapped out to hard disk and the required page has been loaded into memory

18 © De Montfort University, 2004CSCI2413 - L218 Swapping When physical memory (RAM) becomes full the supervisor searches for unused pages –the unused page(s) (instructions or data pages from an inactive process) are copied out to hard disk –the required page is then loaded into RAM this is called swapping If a swapped-out page is required again another page is copied out and the needed one copied in –sometimes the OS can spend so much time swapping pages that little or no useful processing is done this is called disk thrashing

19 © De Montfort University, 2004CSCI2413 - L219 Virtual Machines The virtual machine concept takes virtual memory one stage further –a real machine simulates a number of virtual machines –each virtual machine has its own operating system (supervisor task) in its own block of virtual memory –all machine interaction (input / output) takes place via an underlying virtual machine controller task Intel processors have provided hardware support for virtual machines since 486’s –VMWare is a virtual machine program for PC’s –allows e.g. Win 95, Win NT and Linux to run at once

20 © De Montfort University, 2004CSCI2413 - L220 main memory Virtual Machine I llustration user process 1 virtual machine task supervisor task 1 (e.g. Win 95) user process 2 supervisor task 2 (e.g. Win NT) user process 3 supervisor task 3 (e.g. Linux)

Download ppt "Operating Systems (CSCI2413) Lecture 2 Overview phones off (please)"

Similar presentations

Ads by Google