1 / 58

Introduction

Introduction. 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 . Chapter 1. Introduction. A computer system consists of hardware

osborn
Télécharger la présentation

Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction 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 Chapter 1

  2. Introduction • A computer system consists of • hardware • system programs • application programs

  3. What is an Operating System • 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. History of Operating Systems (1) • First generation 1945 - 1955 • vacuum tubes, plug boards • Second generation 1955 - 1965 • transistors, batch systems • Third generation 1965 – 1980 • ICs and multiprogramming • Fourth generation 1980 – present • personal computers and workstations (Network operating systems and distributed operating systems)

  5. History of Operating Systems (2) Early batch system • bring cards to 1401 • read cards to tape • put tape on 7094 which does computing • put tape on 1401 which prints output

  6. History of Operating Systems (3) • Structure of a typical FMS job – 2nd generation

  7. History of Operating Systems (4) • Multiprogramming system • three jobs in memory – 3rd generation

  8. Fourth generation 1980 – Present • Operating systems for personal computers • CP/M (Control Program for Microcomputers) • DOS (Disk Operating System)  MS-DOS • GUI (Graphical User Interface) • Windows  Windows 95/98/Me • Windows NT  Windows 2000 Windows XP • UNIX: • X Windows, Motif • Linux, Gnome, KDE

  9. The Operating System Zoo • Mainframe operating systems • Example: OS/390, OS/360 • Server operating systems • Example: UNIX, Windows 2000, Linux • Multiprocessor operating systems • Personal computer operating systems • Windows 98, 2000, XP, Macintosh, Linux • Real-time operating systems • Hard real-time system: the action absolutely must occur at a certain moment. • Embedded operating systems • PalmOS, Pocket PC for PDA • Smart card operating systems • Java Virtual Machine (JVM)

  10. Computer Hardware Review (1) Monitor • Components of a simple personal computer Bus

  11. Computer Hardware Review (CPU) (a) A three-stage pipeline (b) A superscalar CPU

  12. Computer Hardware Review (Memory) • Typical memory hierarchy • numbers shown are rough approximations

  13. Computer Hardware Review (disk) Structure of a disk drive

  14. Computer Hardware Review (5) One base-limit pair and two base-limit pairs

  15. Computer Hardware Review (I/O) (a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted (a) (b)

  16. Computer Hardware Review (Buses) Structure of a large Pentium system

  17. Operating System Concepts (Processes) • A process is a program in execution. • The information about a process is stored in an operating system table called the process table. • A process called the command interpreter or shell read commands from a terminal. • If a process can create one or more other process (child processes) and these process create child processes, we can build them in a tree structure. • In UNIX, there is a parent process for all processes.

  18. Operating System Concepts (Processes) • A process tree • A created two child processes, B and C • B created three child processes, D, E, and F

  19. Processes Tree on a UNIX System

  20. Operating System Concepts (Processes) • The communication to cooperate and synchronize processes is called interprocess communication. • A signal causes the process to suspend and run a special signal handling procedure. • Each person authorized to use a system is assigned a UID (User IDentification). A process is assigned a PID (Process IDentification). • Users can be members of groups, each of which has a GID (Group IDentification). • The superuser (root in UNIX) has special privilege to violate many of the protection rules.

  21. Operating System Concepts (Deadlocks) • When two or more processes get themselves into a stalemate situation, they are in deadlock. (a) A potential deadlock. (b) an actual deadlock.

  22. Operating System Concepts (Memory & Files) • In virtual memory the operating system keeps part of the address space in main memory and part on disk. • A file system provides users with a nice, clean abstract model of device-independent files. • A directory is used to group files together. • A path name can specify the location of a file. • A root directory is the top of the directory hierarchy. In Unix, / is the root directory. • Each process has a current working directory (pwd).

  23. Operating System Concepts (Files) File system for a university department

  24. Operating System Concepts (Files) • If a file access is permitted, the system return small integer called a file descriptor to use in subsequent operations. • In UNIX the mounted file system is used to deal with removable media (mount). • Two kinds of special files exist in UNIX under the /dev directory: blockspecial files (disks) and character special files (printers, modems). • A pipe is a sort of pseudo file that can be used to connect two processes (ps –aef | more).

  25. Operating System Concepts (Files) • Before mounting, • files on floppy are inaccessible • After mounting floppy on b, • files on floppy are part of file hierarchy

  26. Operating System Concepts (Pipes) Two processes connected by a pipe

  27. Operating System Concepts (Security & Shell) • Files in UNIX are protected by a 9-bit binary protection code. • The protection code consists of three 3-bit fields, one for owner, one for group, and one for others. • Each field has a bit for read, a bit for write, and a bit for execute. They are known as rwx bits. • The UNIX command interpreter is called the shell. • Many shells exist, including sh, csh, ksh, and bash. • The user can use < and > to redirect the standard input and output. The ampersand (&) can be put after a command to start it as a background job.

  28. 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., C, C++).

  29. Steps in Making a System Call There are 11 steps in making the system call read (fd, buffer, nbytes)

  30. Types of System Calls • Process management • File management • Directory or Device management • Miscellaneous • Information maintenance • Communications • Some POSIX (Portable Operating System Interface) are listed as follows.

  31. Some System Calls For Process Management

  32. Some System Calls For File Management

  33. Some System Calls For Directory Management

  34. Some System Calls For Miscellaneous Tasks

  35. System Calls for Process • Process management • File management • Directory or Device management • Miscellaneous • Information maintenance • Communications • Some POSIX (Portable Operating System Interface) are listed as follows.

  36. System Calls for Process • Fork creates a duplicate of the original process. • UNIX examples (Fig4-8.c) • fork system call creates new process. • exec system call used after a fork to replace the process’ memory space with a new program. • wait system call used to move the parent process off the ready queue until the termination of the child. • Exit system call is used when a process is finished executing. • Try the ps command.

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

  38. Forking Processes /* fork processes */ main() { int i, pid; for (i=1; i<=3; i++) { if ((pid = fork()) == 0) { printf("In child %d. \n", i); } } }

  39. Forking Processes P I = 2 I = 3 I = 1 I = 2 I = 3 I = 3 I = 3

  40. System Calls for Process • Processes in UNIX have their memory divided up into three segments: • The text segment (the program code) • The data segment (the variables) grows upwards. • The stack segment (functions) grows downwards.

  41. System Calls (Process) • Processes have three segments: text, data, stack

  42. System Calls (Directory) link(“/usr/jim/memo”, “/usr/ast/note”); (a) Two directories before linking/usr/jim/memo to ast's directory (b) The same directories after linking

  43. System Calls (Device) mount(“/dev/fd0”, “/mnt”, 0) (a) File system before the mount (b) File system after the mount

  44. System Calls (Win32) Some Win32 API calls

  45. Operating System Structure • Monolithic System - "the big mess". All operating system operations are put into a single file. The operating system is a collection of procedures, each of which can call any of the others. • Layered System - The operating system is organized as a hierarchy of layers of processes. • THE operating system • Virtual Machine - The operating system is a timesharing system that provides: (a) multiprogramming and (b) an extended machine. • MS-DOS virtual mode • JVM (Java Virtual Machine)

  46. Operating System Structure (Monolithic) Simple structuring model for a monolithic system

  47. Operating System Structure (Layer) Structure of the THE operating system

  48. Operating System Structure • Exokernels - The only job of the operating system is to securely allocate the hardware resources. • Transmeta ? • Client-server Model - The operating system is collection of servers that provide specific services; e.g., file server, etc. • Advantages of client-server model: • Servers are running in user mode. If they crash, the system won’t crash. • Adapt to use in distributed systems.

  49. Operating System Structure (Virtual Machine) Structure of VM/370 with CMS

  50. Operating System Structure (Client-server) The client-server model

More Related