Operating-System Operating-System Structures Structures 1. 1. Operating-System System Components Operating-System System Components 2. 2. Operating System Services Operating System Services 3. 3. System Calls System Calls 4. 4. System Structure System Structure 5. 5. Virtual Machines Virtual Machines 6. 6. System Design and Implementation System Design and Implementation 7. 7. System Generation System Generation
31
Embed
Operating-System Structures 1. Operating-System System Components 2. Operating System Services 3. System Calls 4. System Structure 5. Virtual Machines.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
1.1. Operating-System System ComponentsOperating-System System Components
2.2. Operating System ServicesOperating System Services
3.3. System CallsSystem Calls
4.4. System Structure System Structure
5.5. Virtual MachinesVirtual Machines
6.6. System Design and ImplementationSystem Design and Implementation
7.7. System GenerationSystem Generation
1.Operating System Components1.Operating System Components
Process Management Process Management Main Memory ManagementMain Memory Management File ManagementFile Management I/O System ManagementI/O System Management Secondary ManagementSecondary Management NetworkingNetworking Protection SystemProtection System Command-Interpreter SystemCommand-Interpreter System
1. Process Management1. Process Management
A A processprocess is a program in execution is a program in execution• A process needs certain resources, A process needs certain resources,
including CPU time, memory, files, and I/O including CPU time, memory, files, and I/O devices, to accomplish its taskdevices, to accomplish its task
The operating system is responsible for the The operating system is responsible for the following activities in connection with following activities in connection with process managementprocess management• Process creation and deletionProcess creation and deletion• Process suspension and resumptionProcess suspension and resumption• Provision of mechanisms for:Provision of mechanisms for:
process synchronizationprocess synchronization process communicationprocess communication
MemoryMemory is a large array of words or bytes, each with its is a large array of words or bytes, each with its own addressown address
• It is responsible for quickly accessible data It is responsible for quickly accessible data shared by the CPU and I/O devicesshared by the CPU and I/O devices
Main memoryMain memory is a volatile storage device. It loses its is a volatile storage device. It loses its contents in the case of system failurecontents in the case of system failure
The operating system is responsible for the following The operating system is responsible for the following activities in connections with memory managementactivities in connections with memory management• Keep track of which parts of memory are currently Keep track of which parts of memory are currently
being used and by whombeing used and by whom• Decide which processes to load when memory Decide which processes to load when memory
space becomes availablespace becomes available• Allocate and deallocate memory space as neededAllocate and deallocate memory space as needed
A A filefile is a collection of related information defined is a collection of related information defined by its creatorby its creator
• Commonly, files represent programs and dataCommonly, files represent programs and data The operating system is responsible for the The operating system is responsible for the
following activities in connections with file following activities in connections with file management:management:• File creation and deletionFile creation and deletion• Directory creation and deletionDirectory creation and deletion• Support of primitives for manipulating files and Support of primitives for manipulating files and
The I/O system consists of:The I/O system consists of:• A buffer-caching system A buffer-caching system • A general device-driver interfaceA general device-driver interface• Drivers for specific hardware devicesDrivers for specific hardware devices
Since main memory (Since main memory (primary storageprimary storage) is volatile ) is volatile and too small to accommodate all data and and too small to accommodate all data and programs permanently, the computer system programs permanently, the computer system must provide must provide secondary storagesecondary storage to back up main to back up main memorymemory
The operating system is responsible for the The operating system is responsible for the following activities in connection with disk following activities in connection with disk management: management: • Free space managementFree space management• Storage allocationStorage allocation• Disk schedulingDisk scheduling
A A distributeddistributed system is a collection processors system is a collection processors that do not share memory or a clockthat do not share memory or a clock• Each processor has its own local memoryEach processor has its own local memory
The processors in the system are connected The processors in the system are connected through a communication networkthrough a communication network
Communication takes place using a Communication takes place using a protocolprotocol A distributed system provides user access to A distributed system provides user access to
various system resourcesvarious system resources Access to a shared resource allows:Access to a shared resource allows:
• Computation speed-up Computation speed-up • Increased data availabilityIncreased data availability• Enhanced reliabilityEnhanced reliability
7. Protection System7. Protection System
ProtectionProtection refers to a refers to a mechanism for controlling mechanism for controlling accessaccess by programs, processes, or users to both by programs, processes, or users to both system and user resourcessystem and user resources
The protection mechanism must: The protection mechanism must: • distinguish between distinguish between authorizedauthorized and and unauthorizedunauthorized usage usage
• specify the controls to be imposedspecify the controls to be imposed• provide a means of enforcementprovide a means of enforcement
8. Command-Interpreter System8. Command-Interpreter System
Many commands are given to the operating Many commands are given to the operating system by control statements which deal with:system by control statements which deal with:• Process creation and managementProcess creation and management• I/O handlingI/O handling• Secondary-storage managementSecondary-storage management• Main-memory managementMain-memory management• File-system access File-system access • Protection Protection • NetworkingNetworking
1.1. Program execution – System capability to Program execution – System capability to load a program into memory and to run itload a program into memory and to run it
2.2. I/O operations – Since user programs I/O operations – Since user programs cannot execute I/O operations directly, the cannot execute I/O operations directly, the operating system must provide some operating system must provide some means to perform I/Omeans to perform I/O
3.3. File-system manipulation – Program File-system manipulation – Program capability to read, write, create, and capability to read, write, create, and delete filesdelete files
3.System Calls3.System Calls
Operating System ServicesOperating System Services
4.4. Communications – Exchange of Communications – Exchange of information between processes executing information between processes executing either on the same computer or on either on the same computer or on different systems tied together by a different systems tied together by a network. Implemented via shared network. Implemented via shared memory or message passingmemory or message passing
5.5. Error detection – Ensure correct Error detection – Ensure correct computing by detecting errors in the CPU computing by detecting errors in the CPU and memory hardware, in I/O devices, or and memory hardware, in I/O devices, or in user programsin user programs
Additional Operating System FunctionsAdditional Operating System Functions
Additional functions exist not for helping the user, Additional functions exist not for helping the user, but rather for ensuring efficient system operationsbut rather for ensuring efficient system operations
• Resource allocation – allocating resources to Resource allocation – allocating resources to multiple users or multiple jobs running at the multiple users or multiple jobs running at the same timesame time
• Accounting – keep track of and record which Accounting – keep track of and record which users use how much and what kinds of users use how much and what kinds of computer resources for account billing or for computer resources for account billing or for accumulating usage statisticsaccumulating usage statistics
• Protection – ensuring that all access to system Protection – ensuring that all access to system resources is controlledresources is controlled
System callsSystem calls provide the interface between a provide the interface between a running program and the operating systemrunning program and the operating system• Generally available as assembly-Generally available as assembly-
language instructionslanguage instructions• Languages defined to replace assembly Languages defined to replace assembly
language for systems programming allow language for systems programming allow system calls to be made directly (e.g., C, system calls to be made directly (e.g., C, C++)C++)
System CallsSystem Calls
Three general methods are used to Three general methods are used to pass pass parametersparameters between a running program between a running program and the operating systemand the operating system• Pass Pass parametersparameters in in registersregisters• Store the parameters in a table in Store the parameters in a table in
memory, and the memory, and the table addresstable address is is passed as a parameter in a registerpassed as a parameter in a register
• PushPush (store) the parameters onto the (store) the parameters onto the stackstack by the program, and by the program, and poppop off the off the stack by operating systemstack by operating system
Passing of Parameters As A TablePassing of Parameters As A Table
Types of System CallsTypes of System Calls
Process controlProcess control File managementFile management Device managementDevice management Information maintenanceInformation maintenance CommunicationsCommunications
Communication ModelsCommunication Models
Message Passing Shared Memory
Communication may take place using either Communication may take place using either message passing or shared memorymessage passing or shared memory
4. MS-DOS System Structure4. MS-DOS System Structure
MS-DOS – written to provide the most MS-DOS – written to provide the most functionality in the least spacefunctionality in the least space• Not divided into modulesNot divided into modules• Although MS-DOS has some structure, its Although MS-DOS has some structure, its
interfaces and levels of functionality are not interfaces and levels of functionality are not well separatedwell separated
MS-DOS Layer StructureMS-DOS Layer Structure
Layered ApproachLayered Approach
The operating system is divided into a number of The operating system is divided into a number of layers (levels), each built on top of lower layers. layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface.highest (layer N) is the user interface.
With modularity, layers are selected such that With modularity, layers are selected such that each uses functions (operations) and services of each uses functions (operations) and services of only lower-level layersonly lower-level layers
An Operating System LayerAn Operating System Layer
Microkernel System Structure Microkernel System Structure
Moves as much from the kernel into “Moves as much from the kernel into “useruser” space” space Communication takes place between user Communication takes place between user
modules using message passingmodules using message passing Benefits:Benefits:
• Easier to extend a microkernelEasier to extend a microkernel• Easier to port the operating system to new Easier to port the operating system to new
architecturesarchitectures• More reliable (less code is running in kernel More reliable (less code is running in kernel
mode)mode)• More secureMore secure
Windows NT Client-Server StructureWindows NT Client-Server Structure
5.Virtual Machines5.Virtual Machines
A A virtual machinevirtual machine takes the layered approach to takes the layered approach to its logical conclusion. It treats hardware and the its logical conclusion. It treats hardware and the operating system kernel as though they were all operating system kernel as though they were all hardwarehardware
A virtual machine provides an interface A virtual machine provides an interface identicalidentical to the underlying bare hardwareto the underlying bare hardware
The operating system creates the illusion of The operating system creates the illusion of multiple processes, each executing on its own multiple processes, each executing on its own processor with its own (virtual) memoryprocessor with its own (virtual) memory
Virtual Machines (Cont.)Virtual Machines (Cont.)
The resources of the physical computer are The resources of the physical computer are shared to create the virtual machinesshared to create the virtual machines• CPU scheduling can create the appearance CPU scheduling can create the appearance
that users have their own processorthat users have their own processor• Spooling and a file system can provide virtual Spooling and a file system can provide virtual
card readers and virtual line printerscard readers and virtual line printers• A normal user time-sharing terminal serves as A normal user time-sharing terminal serves as
the virtual machine operator’s consolethe virtual machine operator’s console
System ModelsSystem Models
Non-virtual Machine Virtual Machine
Advantages/Disadvantages of Virtual MachinesAdvantages/Disadvantages of Virtual Machines
The virtual-machine concept provides complete The virtual-machine concept provides complete protection of system resources since each virtual protection of system resources since each virtual machine is isolated from all other virtual machine is isolated from all other virtual machines. This isolation, however, permits no machines. This isolation, however, permits no direct sharing of resources.direct sharing of resources.
A virtual-machine system is a perfect vehicle for A virtual-machine system is a perfect vehicle for operating-systems research and development. operating-systems research and development. System development is done on the virtual System development is done on the virtual machine, instead of on a physical machine and so machine, instead of on a physical machine and so does not disrupt normal system operation.does not disrupt normal system operation.
The virtual machine concept is difficult to The virtual machine concept is difficult to implement due to the effort required to provide an implement due to the effort required to provide an exactexact duplicate to the underlying machine duplicate to the underlying machine
System Design GoalsSystem Design Goals
User goals – operating system should be User goals – operating system should be convenient to use, easy to learn, reliable, safe, convenient to use, easy to learn, reliable, safe, and fastand fast
System goals – operating system should be easy System goals – operating system should be easy to design, implement, and maintain, as well as to design, implement, and maintain, as well as flexible, reliable, error-free, and efficientflexible, reliable, error-free, and efficient
System Generation (SYSGEN)System Generation (SYSGEN)
Operating systems are designed to run on any of Operating systems are designed to run on any of a class of machines; the system must be a class of machines; the system must be configured for each specific computer siteconfigured for each specific computer site
SYSGEN program obtains information concerning SYSGEN program obtains information concerning the specific configuration of the hardware systemthe specific configuration of the hardware system
BootingBooting – starting a computer by loading the – starting a computer by loading the kernelkernel
Bootstrap programBootstrap program – code stored in ROM that is – code stored in ROM that is able to locate the kernel, load it into memory, able to locate the kernel, load it into memory, and start its executionand start its execution