Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating System Concepts

Similar presentations


Presentation on theme: "Operating System Concepts"— Presentation transcript:

1 Operating System Concepts
Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

2 Chapter 3 Operating System Structures
An operating system can be viewed from several vantage points. Services Interfaces to users and programmers Components and their interconnections Ku-Yaw Chang Chapter 3 Operating-System Structures

3 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

4 Chapter 3 Operating-System Structures
3.1 System Components Common system components Process Management Main Memory Management File Management I/O System Management Secondary Management Networking Protection System Command-Interpreter System Ku-Yaw Chang Chapter 3 Operating-System Structures

5 Chapter 3 Operating-System Structures
3.1.1 Process Management A process A program in execution Resources CPU time Memory Files I/O devices Ku-Yaw Chang Chapter 3 Operating-System Structures

6 Chapter 3 Operating-System Structures
Process v.s. Program A program by itself is not a process. A program is a passive entity Contents of a file stored on disk A process is an active entity A program counter specifies the next instruction to execute A program spawns many processes as it runs. Ku-Yaw Chang Chapter 3 Operating-System Structures

7 Chapter 3 Operating-System Structures
Process Management A computer Consists of a collection of processes Operating-system processes User processes Be executed concurrently, by multiplexing the CPU among them. OS is responsible for Creating and deleting both user and system processes Suspending and resuming processes Providing mechanisms for process synchronization Providing mechanisms for process communication Providing mechanisms for deadlock handling (Chapters 4 through 7) Ku-Yaw Chang Chapter 3 Operating-System Structures

8 3.1.2 Main-Memory Management
a large array of words or bytes, each with its own address. a repository of quickly accessible data shared by the CPU and I/O devices. a volatile storage device OS is responsible for Keeping track of which parts of memory are currently being used and by whom Deciding which processes are to be loaded into memory when memory space becomes available Allocating and deallocating memory space as needed (Chapters 9 and 10) Ku-Yaw Chang Chapter 3 Operating-System Structures

9 Chapter 3 Operating-System Structures
3.1.3 File Management Physical Media Magnetic tape Magnetic disk Optical disk OS provides a uniform logical view of information storage – the file Map files onto physical media Access files via storage devices A file a collection of related information defined by its creator represent programs (both source and object forms) and data Directory (or folder) Ku-Yaw Chang Chapter 3 Operating-System Structures

10 Chapter 3 Operating-System Structures
3.1.3 File Management OS is responsible for Creating and deleting files Creating and deleting directories Supporting primitives for manipulating files and directories Mapping files onto secondary storage Backing up files on stable (nonvolatile) storage media (Chapters 11 and 12) Ku-Yaw Chang Chapter 3 Operating-System Structures

11 3.1.4 I/O-System Management
The peculiarities of I/O devices are hidden from the bulk of the operating system itself by the I/O subsystem. A memory-management component that includes buffering, caching, and spooling A general device-driver interface Drivers for specific hardware devices (Chapter 13) Ku-Yaw Chang Chapter 3 Operating-System Structures

12 3.1.5 Secondary-Storage Management
Primary storage Main memory Secondary storage Disks Principal on-line storage medium Source and destination of processing OS is responsible for Free-space management Storage allocation Disk scheduling (Chapter 14) Ku-Yaw Chang Chapter 3 Operating-System Structures

13 Chapter 3 Operating-System Structures
3.1.6 Networking A distributed system is a collection processors that do not share memory or a clock. Each processor has its own local memory. The processors in the system are connected through a communication network. Communication takes place using a protocol. A distributed system provides user access to various system resources. Ku-Yaw Chang Chapter 3 Operating-System Structures

14 Chapter 3 Operating-System Structures
3.1.6 Networking Access to a shared resource allows Computation speedup Increased functionality Increased data availability Enhanced reliability OSs usually generalize network access as a form of file access Details are contained in the network interface’s device driver (Chapters 15 through 17) Ku-Yaw Chang Chapter 3 Operating-System Structures

15 Chapter 3 Operating-System Structures
3.1.7 Protection System Protection a mechanism for controlling access by programs, processes, or users to both system and user resources. The protection mechanism must distinguish between authorized and unauthorized usage specify the controls to be imposed provide a means of enforcement (Chapter 18) Ku-Yaw Chang Chapter 3 Operating-System Structures

16 3.1.8 Command-Interpreter System
Interface between the user and the OS Included in the kernel or as a special program Control statements Commands given to the OS Shell Also called control-card interpreter, or the command-line interpreter To get the next command statement and execute it Ku-Yaw Chang Chapter 3 Operating-System Structures

17 3.1.8 Command-Interpreter System
Command statements process creation and management I/O handling secondary-storage management main-memory management file-system access protection networking Ku-Yaw Chang Chapter 3 Operating-System Structures

18 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

19 3.2 Operating-System Services
Common services Program execution to load a program into memory and to run it. I/O operations user programs cannot execute I/O operations directly File-system manipulation capability to read, write, create, and delete files. Communications exchange of information between processes Implemented via shared memory or message passing. Error detection ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs. Ku-Yaw Chang Chapter 3 Operating-System Structures

20 Chapter 3 Operating-System Structures
Additional Functions Not for helping the user, but rather for ensuring efficient system operations. Resource allocation allocate resources to multiple users or multiple jobs running at the same time Accounting keep track of and record which users use how much and what kinds of computer resources for account billing or for accumulating usage statistics Protection ensure that all access to system resources is controlled Ku-Yaw Chang Chapter 3 Operating-System Structures

21 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

22 Chapter 3 Operating-System Structures
3.3 System Calls System calls The interface between a process and the OS Assembly-language Higher-level language C, C++ and Perl Modern Microsoft Windows platforms Win32 API (application programmer interface) Even simple programs may make heavy use of the operating system. To read data from one file and to copy them to another file Requiring a sequence of system calls Details are hidden from the programmer Ku-Yaw Chang Chapter 3 Operating-System Structures

23 Chapter 3 Operating-System Structures
3.3 System Calls Pass parameters to the OS In registers Parameters may be more than registers In a block or table in memory The address is passed as a parameter in a register Stack Push parameters onto the stack by the program Pop off the stack by operating system Ku-Yaw Chang Chapter 3 Operating-System Structures

24 Passing of parameters as a table
Ku-Yaw Chang Chapter 3 Operating-System Structures

25 Chapter 3 Operating-System Structures
3.3 System Calls Five major categories Process control File management Device management Information maintenance Communications Ku-Yaw Chang Chapter 3 Operating-System Structures

26 Chapter 3 Operating-System Structures
MS-DOS At System Start-up Running a Program Ku-Yaw Chang Chapter 3 Operating-System Structures

27 UNIX running multiple programs
Ku-Yaw Chang Chapter 3 Operating-System Structures

28 Chapter 3 Operating-System Structures
3.3.5 Communication Message Passing Shared Memory Ku-Yaw Chang Chapter 3 Operating-System Structures

29 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

30 Chapter 3 Operating-System Structures
3.4 System Programs System programs provide a convenient environment for program development and execution File management Status information File modification Programming language support Program loading and execution Communication System utilities or application programs To solve common problems, or perform common operations Web browsers and word processors Games Ku-Yaw Chang Chapter 3 Operating-System Structures

31 Chapter 3 Operating-System Structures
3.4 System Programs Command interpreter The most important system program Two approaches The command interpreter contains the code to execute the command. Implement most commands by system programs Ku-Yaw Chang Chapter 3 Operating-System Structures

32 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

33 Chapter 3 Operating-System Structures
To partition the task (OS) into small components (modules) Not one monolithic system Available approaches Simple structure Layered approach Microkernels Ku-Yaw Chang Chapter 3 Operating-System Structures

34 Chapter 3 Operating-System Structures
3.5.1 Simple Structure MS-DOS written to provide the most functionality in the least space not divided into modules Although having some structure, its interfaces and levels of functionality are not well separated Ku-Yaw Chang Chapter 3 Operating-System Structures

35 MS-DOS layer structure
Ku-Yaw Chang Chapter 3 Operating-System Structures

36 Chapter 3 Operating-System Structures
3.5.1 Simple Structure UNIX Initially limited by hardware functionality consists of two separable parts The kernel Everything below the system-call interface and above the physical hardware Systems programs Ku-Yaw Chang Chapter 3 Operating-System Structures

37 Chapter 3 Operating-System Structures
Unix System Structure Ku-Yaw Chang Chapter 3 Operating-System Structures

38 Chapter 3 Operating-System Structures
3.5.2 Layered Approach OS is broken into a number of layers (or levels) Each built on top of lower layers The bottom layer (layer 0) is the hardware The highest layer (layer N) is the user interface With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers. Simplify debugging and system verification Difficult to define each layer Less efficient – overhead Ku-Yaw Chang Chapter 3 Operating-System Structures

39 Chapter 3 Operating-System Structures
An OS layer Ku-Yaw Chang Chapter 3 Operating-System Structures

40 Chapter 3 Operating-System Structures
OS/2 layer structure Ku-Yaw Chang Chapter 3 Operating-System Structures

41 Chapter 3 Operating-System Structures
Windows NT First release A highly layer-oriented organization Low performance (compared to Windows 95) NT 4.0 Move layers from user space to kernel space Closely integration Ku-Yaw Chang Chapter 3 Operating-System Structures

42 Chapter 3 Operating-System Structures
3.5.3 Microkernels Unix Kernel became large and difficult to manage Mach Developed at Carnegie Mellon University in the mid-1980s Use the microkernel approach Removing non-essential components from the kernel Implement them as system- and user-level programs A smaller kernel Main function To provide a communication facility Ku-Yaw Chang Chapter 3 Operating-System Structures

43 Chapter 3 Operating-System Structures
3.5.3 Microkernels Benefits easier to extend easier to port to new architectures more reliable (less code is running in kernel mode) more secure Examples Tru64 UNIX – UNIX + Mach kernel MacOS X – based on Mach kernel QNX – a real-time OS Windows NT ( a hybrid structure) Ku-Yaw Chang Chapter 3 Operating-System Structures

44 Windows NT client-server structure
Ku-Yaw Chang Chapter 3 Operating-System Structures

45 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

46 Chapter 3 Operating-System Structures
3.6 Virtual Machines A computer system is made up of layers Hardware is the lowest Virtual machines take the layered approach to its logical conclusion treat hardware and the operating system kernel as though they were all hardware provide an interface identical to the underlying bare hardware. The OS creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory. Ku-Yaw Chang Chapter 3 Operating-System Structures

47 Chapter 3 Operating-System Structures
System Models Non-virtual Machine Virtual Machine Ku-Yaw Chang Chapter 3 Operating-System Structures

48 Chapter 3 Operating-System Structures
3.6.1 Implementation Difficult to implement To provide an exact duplicate of the underlying machine User mode Monitor mode Time – the major difference I/O Less time or more time CPU Multiprogrammed among many virtual machines Ku-Yaw Chang Chapter 3 Operating-System Structures

49 Chapter 3 Operating-System Structures
3.6.2 Benefits Provide complete protection of system resources Each virtual machine is isolated from all other virtual machines. Permits no direct sharing of resources. A perfect vehicle for operating-systems research and development System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation. Solve system compatibility problems Ku-Yaw Chang Chapter 3 Operating-System Structures

50 Chapter 3 Operating-System Structures
3.6.3 Java A very popular object-oriented language By Sun Microsystems in late 1995 Consists of A language specification A large API library A specification for a Java virtual machine(JVM) A class loader A class verifier A Java interpreter Ku-Yaw Chang Chapter 3 Operating-System Structures

51 Chapter 3 Operating-System Structures
3.6.3 Java A Java program consists of one or more classes. For each class, the Java compiler produce an architecture-neutral bytecode output (.class) file Run on any implementation of the JVM Ku-Yaw Chang Chapter 3 Operating-System Structures

52 Chapter 3 Operating-System Structures
Java virtual machine Ku-Yaw Chang Chapter 3 Operating-System Structures

53 Chapter 3 Operating-System Structures
3.6.3 Java Garbage collection Reclaim memory from objects no longer in use and return it to the system Just-in-time (JIT) compiler Turn the architecture-neutral bytecodes to native machine language for the host computer Ku-Yaw Chang Chapter 3 Operating-System Structures

54 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

55 3.7 System Design and Implementation
A discussion about problems when designing and implementing an operating system Ku-Yaw Chang Chapter 3 Operating-System Structures

56 Chapter 3 Operating-System Structures
3.7.1 Design Goals User goals should be convenient to use, easy to learn, reliable, safe, and fast. System goals should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient. Ku-Yaw Chang Chapter 3 Operating-System Structures

57 3.7.2 Mechanisms and Policies
General software engineering principles are applicable to operating systems. Separation of policy from mechanism For flexibility Mechanisms How to do something A general mechanism Policies What will be done Change across places or over time Ku-Yaw Chang Chapter 3 Operating-System Structures

58 3.7.2 Mechanisms and Policies
Microkernel Take the separation of mechanism and policy to one extreme Apple Macintosh Both mechanism and policy are encoded in the system Ku-Yaw Chang Chapter 3 Operating-System Structures

59 Chapter 3 Operating-System Structures
3.7.3 Implementation Traditionally written in assembly language, operating systems can now be written in higher-level languages. Code written in a high-level language: can be written faster. is more compact. is easier to understand and debug. is easier to port (move to some other hardware) Ku-Yaw Chang Chapter 3 Operating-System Structures

60 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

61 Chapter 3 Operating-System Structures
3.8 System Generation Operating systems are designed to run on any of a class of machines. must be configured for each specific computer site. System generation (SYSGEN) obtain information concerning the specific configuration of the hardware system. From a given file Ask the operator Ku-Yaw Chang Chapter 3 Operating-System Structures

62 Chapter 3 Operating-System Structures
3.8 System Generation Booting starting a computer by loading the kernel. Bootstrap program (bootstrap loader) code stored in ROM that is able to locate the kernel, load it into memory, and start its execution. Ku-Yaw Chang Chapter 3 Operating-System Structures

63 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

64 Chapter 3 Operating-System Structures
Summary P.89 – P.90 Ku-Yaw Chang Chapter 3 Operating-System Structures

65 Chapter 3 Operating-System Structures
System Components Operating-System Services System Calls System Programs System Structures Virtual Machines System Design and Implementation System Generation Summary Exercises Ku-Yaw Chang Chapter 3 Operating-System Structures

66 Chapter 3 Operating-System Structures
Exercises 3.5 3.12 3.13 3.14 3.15 Ku-Yaw Chang Chapter 3 Operating-System Structures

67 The End


Download ppt "Operating System Concepts"

Similar presentations


Ads by Google