Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Introduction Chapter 1 1.1 What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.

Similar presentations


Presentation on theme: "1 Introduction Chapter 1 1.1 What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5."— Presentation transcript:

1 1 Introduction Chapter 1 1.1 What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5 Operating system concepts 1.6 System calls 1.7 Operating system structure

2 2 A typical computer system OPERATING SYSTEM

3 3 What is an Operating System? - 1.1 It is an extended machine –Hides the messy details which must be performed –Presents user with a virtual machine, easier to use It is a resource manager –Each program gets time with the resource –Each program gets space on the resource

4 4 Two modes of execution OS programs execute in kernel or supervisor mode All other programs execute in user mode When a a user process is executing (in user mode) and it requires something form the OS, it issues a system call to the OS –The computer switches to kernel mode so that the OS can execute

5 5 History of computers – 1.2 First generation 1945 - 1955 –vacuum tubes, plug boards Second generation 1955 - 1965 –transistors, batch systems Third generation 1965 – 1980 –ICs and multiprogramming, spooling Fourth generation 1980 – present –personal computers

6 6 2 nd generation computing OS used here to distinguish jobs from one another

7 7 In the 2 nd generation – what was on those cards

8 8 3 rd generation multiprogramming Allowed the interleaving of jobs between CPU & I/O activity

9 9 4 th generation computing GUI’s Multimedia Networks Virtual memory techniques

10 10 The Operating System “Zoo” – 1.3 Mainframe operating systems Server operating systems Multiprocessor operating systems Personal computer operating systems Real-time operating systems Embedded operating systems Smart card operating systems

11 11 Components of a simple personal computer – 1.4 Monitor Bus

12 12 Processors CPU –Registers General purpose Special purpose –Program counter –Stack pointer –PSW

13 13 Fetch-execute cycle CPU fetches the instruction whose address is in the program counter CPU increments program counter to point to the next instruction CPU decodes instruction and locates data & destination of the result CPU executes the instruction Back to top

14 14 Pipelining & super-scalar CPU’s Enhancements to fetch-execute cycle

15 15 Typical memory hierarchy

16 16 Base-limit registers Hardware protection for programs & OS

17 17 I/O devices Two parts to a device –Controller Chip that physically controls the device Accepts commands from the OS Presents a simple interface to the OS –Hides the complicated details of the device from the OS Device driver software, which runs in kernel mode, is affiliated with the OS –Actual device

18 18 Three methods of I/O Busy waiting –Once I/O starts, CPU continually polls the I/O device to find out when I/O is complete (and what its status is) Interrupts Direct Memory Access (DMA) –A DMA chip controls the flow of data between memory & the controller, without requiring constant CPU intervention CPU sets up the DMA chip; when I/O complete DMA interrupts CPU

19 19 What is an interrupt? When the CPU is executing a program and some event takes place in the system that requires its attention/action, the CPU gets interrupted so that it can stop what it is doing and tend to the matter at hand.

20 20 Interrupts Interrupts are used to temporarily suspend execution of a program in order to carry out a more urgent task. Examples are: –Moving a cursor in response to mouse movements –Receiving messages from a network –Stopping execution in case of programming errors –Responding to I/O completion This is the context in which we’ll introduce them.

21 21 I/O operation A user process is executing and needs I/O –cin, cout A system call is made to the OS –The appropriate I/O device driver (functions as part of the OS) is invoked –I/O is initiated by the device controller (part of the I/O device) The process that requested I/O is suspended (waiting for its I/O) and the CPU goes on to some other task (i.e. another process)

22 22 I/O interrupt 1. The disk device driver (part of the OS) tells the disk controller to begin I/O (by writing into its registers). 2. When the disk controller completes the I/O operation, it signals the interrupt controller. 3. The interrupt controller (if not busy with something more important) interrupts the CPU by setting one of its pins. 4. The interrupt controller puts the I/O device # on the bus to the CPU (so CPU knows which device has finished).

23 23 I/O interrupt When the CPU responds to the interrupt, the current PC & PSW are pushed onto the stack; the CPU is switched into kernel mode. The I/O device # serves as an index into an array of addresses of interrupt handlers (IH). (IH’s are functions within device drivers) The IH removes PC & PSW from stack and saves them; then gets the status of I/O completion. The IH returns control of the CPU to the instruction whose address is in the PC (i.e., to the process whose info is in the PSW); original process resumes execution

24 24 Buses Pentium system

25 25 Operating system concepts Processes Deadlocks Memory management I/O File management Security Shell

26 26 Processes A process is a program in execution –It can create other processes (children) –It can also create threads (lightweight processes)

27 27 Deadlocks (a) A potential deadlock. (b) an actual deadlock.

28 28 Memory management Deals with the transfer of data and programs from external memory (HD, flash etc.) into main memory (RAM) A program in execution must be in main memory –Where it is stored is called its address space

29 29 I/O Every OS has an I/O subsystem to manage all I/O devices that are part of the system. –Some I/O software is device-independent –Some I/O software is part of device drivers

30 30 Files File system for a university department

31 31 Shell An OS’ command interpreter –Not technically part of the OS, but relies heavily on OS features When a session is started, a shell is initiated. –Types a prompt –Uses standard keyboard input and screen output

32 32 Recycling of concepts Read Sec. 1.5.8 – p. 43

33 33 System Calls – 1.6 When a program running in user mode needs a service that only the OS can provide, it issues a system call –CPU switches from user to kernel mode –OS routine takes over –Read bottom p. 44

34 34 Many types of system calls For process management For file management For directory management And miscellaneous tasks

35 35 Process management Forking example A stripped down shell: while (true) { /* repeat forever */ type_prompt( ); /* display prompt */ read_command (command, parameters) /* input from terminal */ pid = fork(); if (pid != 0) /* Parent code */ /* fork off child process */ { waitpid( -1, &status, 0); /* wait for child to exit */ } else /* Child code */ /* pid=0 { execve (command, parameters, 0); /* execute command */ }

36 36

37 37 Metric Units The metric prefixes


Download ppt "1 Introduction Chapter 1 1.1 What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5."

Similar presentations


Ads by Google