Download presentation
Presentation is loading. Please wait.
Published byTimo-Pekka Saarnio Modified over 6 years ago
1
Subject Name: Operating Systems Subject Code:10CS53
Prepared By:Mrs.Jisha Jose,Mrs.Thanu Kurian,Mrs.Preethi Sheba Hepsiba Department:Computer Science Date:30/08/2014 9/16/2018
2
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system Structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems Computing environments
3
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
4
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system Structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
5
What Operating systems do?
Q: What is an Operating system? A: A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals: Execute user programs and make solving user problems easier. Make the computer system convenient to use. Use the computer hardware in an efficient manner.
6
Contd.. Computer system can be divided into four components:
Hardware – provides basic computing resources CPU, memory, I/O devices Operating system Controls and coordinates use of hardware among various applications and users Application programs – define the ways in which the system resources are used to solve the computing problems of the users Word processors, compilers, web browsers, database systems, video games Users People, machines, other computers
7
Contd.. User view of an Operating system
Users want convenience, ease of use Don’t care about resource utilization But shared computer such as mainframe or minicomputer must keep all users happy. OS is designed to maximize resource utilization Users sit at workstations connected to networks of other workstations and servers. Os designed to compromise between individual usability & resource utilization. Handheld computers – standalone units for individual users. OS designed mostly for individual usability
8
Contd.. System view of an Operating system OS is a resource allocator
Manages all resources Decides between conflicting requests for efficient and fair resource use OS is a control program Controls execution of programs to prevent errors and improper use of the computer
9
Contd.. Defining Operating Systems No universally accepted definition
“Everything a vendor ships when you order an operating system” is good approximation But varies wildly “The one program running at all times on the computer” is the kernel. Everything else is either a system program or an application program.
10
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
11
Computer System Organization
One or more CPUs, device controllers connect through common bus providing access to shared memory Concurrent execution of CPUs and devices competing for memory cycles Fig: A modern computer system
12
Contd.. Bootstrap program is loaded at power-up or reboot
Typically stored in ROM or EPROM, generally known as firmware Initializes all aspects of system(CPU registers, device controllers, memory contents) Loads operating system kernel and starts execution Occurrence of an event signaled by hardware or software – Interrupt Hardware triggers an interrupt using system bus. Software triggers interrupt using system call.
13
Contd.. Q: What happens when interrupt occurs?
A: CPU stops its current work & immediately transfers execution to a fixed location. Fixed location- starting address of the interrupt service routine On completion of interrupt service routine, CPU resumes execution Fig: Interrupt Time-line for a single process
14
Contd.. Storage Structure
Main memory – only large storage media that the CPU can access directly Random access Typically volatile Secondary storage – extension of main memory that provides large non-volatile storage capacity Magnetic disks – rigid metal or glass platters covered with magnetic recording material Disk surface is logically divided into tracks, which are subdivided into sectors The disk controller determines the logical interaction between the device and the computer
15
Contd.. Typical instruction-execution cycle
i) Fetches an instruction from memory & store it in the instruction register ii )Instruction is decoded Operands are fetched from memory & stored in internal register iii) Instruction is executed & result stored back in memory Need for secondary storage Main memory is too small to store all needed programs and data permanently. Main memory is volatile.
16
Contd.. Storage system hierarchy is based on speed and cost.
Fig: Storage device hierarchy Storage system hierarchy is based on speed and cost. Higher levels are expensive but fast. As we go down, cost/bit decreases and access time increases. Top four levels of memory constructed using semiconductor memory
17
Contd.. Volatile/ Non-volatile memory
Volatile storage- loses its contents when the power is off Main memory, cache, registers Non-volatile storage- No data loss in case of sudden shutdown magnetic disk, optical disk, magnetic tapes DRAM/NVRAM Dynamic Random Access Memory(DRAM)- A semi-conductor technology used to implement Main memory Non-volatile Random Access Memory(NVRAM)- This is DRAM with a battery back-up to make it non-volatile.
18
Contd.. I/O Structure General- purpose computer system consists of CPUs & multiple devices connected through a common bus. Each device controller is in charge of a particular device type. Each device controller has a local buffer & special-purpose registers. Device control moves data from/to peripheral devices to/from local buffers. Each device controller has a device driver.
19
Contd.. How an I/O operation works?
Device driver loads appropriate register within the device controller. Device controller decides the next action to be taken(Ex: read a character from the keyboard). Device controller transfers data from the device to its local buffer. It informs the device driver about the completion of transfer, via an interrupt. Device driver returns control to the OS. Returns data or a pointer in case of read operation
20
Contd.. Direct Memory Access(DMA)
Device controller transfers an entire data block directly to/ from its local buffer to memory without CPU intervention Only one interrupt generated per block instead of one interrupt generated per byte. Suitable for bulk data movement such as disk I/O.
21
Contd.. Multiple components execute concurrently without competing for cycles. These systems use switch instead of bus architecture. DMA is highly effective in these systems.
22
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
23
Computer System Architecture
Single-processor systems Multi-processor systems Clustered systems
24
Contd.. i) Single-Processor system ii) Multiprocessor system
There will be only one main CPU, executing general-purpose instruction set. Special-purpose processors are device specific such as disk, keyboard & graphics controllers or I/O controllers on mainframes. ii) Multiprocessor system Also known as parallel systems, tightly-coupled systems Advantages include: Increased throughput Economy of scale Increased reliability – graceful degradation or fault tolerance
25
Contd.. Two types: Asymmetric Multiprocessing Symmetric Multiprocessing Graceful degradation – Ability of the computer system to continue providing service, proportional to the level of surviving hardware. Fault tolerant systems – Systems which continue operation inspite of failure of one or more components.
26
Contd.. Symmetric/ Asymmetric multi-processing
Each processor is assigned a specific task A master processor controls the system Master processor schedules & allocates work to the slave processors. Defines master-slave relationship Symmetric multi-processing Each processor performs all tasks within the OS. No master-slave relationship exists
27
Contd.. Each processor has its own set of registers & local cache.
Fig: Symmetric multi-processing architecture Each processor has its own set of registers & local cache. However all processors share physical memory. Advantage - Allows processors to share processes and resources dynamically, maximizing CPU utilization
28
Contd.. UMA/NUMA Uniform Memory Access(UMA) – A situation where, the time taken to access any RAM from any CPU will be same. Non-uniform Memory Access(NUMA) – Time taken to access some parts of memory will be longer than accessing other parts, affecting the system performance. On-chip communication/ between-chip communication Between-chip communication- Each chip has a single computing core embedded on it. On-chip communication- Multiple computing cores will be embedded on a single chip. Example- dual core processor with two cores on the same chip On-chip communication is faster than between-chip communication & consumes less power.
29
Contd.. Fig: Dual-core design Blade servers Multiple processor boards, I/O boards & networking boards are placed in the same chassis. Each blade-processor boots independently & runs its own operating system.
30
Contd.. iii) Clustered systems accomplish computational work.
Definition - Multiple CPUs are gathered together to accomplish computational work. Fig: General structure of a clustered system
31
Contd.. Difference between multiprocessor systems and clustered systems In clustered systems, individual systems are connected together. In multiprocessor systems, multiple processors are connected together in a single system. Provides a high-availability service which survives failures Asymmetric clustering has one machine in hot-standby mode Symmetric clustering has multiple nodes running applications, monitoring each other. Some clusters provide high-performance computing (HPC).
32
Contd.. Hot-standby mode
In hot-standby mode, a system does nothing but monitor the active server. If that server fails, the system becomes the active server. High-performance computing Systems running in high-performance computing environment, provide significantly greater computational power than single-processors. Accomplished using parallelization. Divide a program into several components & run them in parallel on individual computers in the cluster.
33
Contd.. Distributed Lock Manager(DLM)
All machines in a cluster have full access to all data in the database. The clustered system must provide access control & locking to avoid conflicting operations. Ex: Oracle Real Application Cluster Storage Area Networks(SANs) Allows many systems to be attached to a pool of storage An application can run on any host, attached to SAN, if the application is stored in SAN. Increases performance & reliability
34
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
35
Operating System Structure
Multi-programming Single user cannot keep CPU and I/O devices busy at all times Multiprogramming organizes jobs (code and data) so CPU always has one to execute. Process of working: 1. Jobs are initially kept in job pool. 2. OS picks one of the jobs & executes in memory. 3. Suppose the selected job has to wait for I/O operation. 4. Now, the OS switches to another job & executes it. 5. Steps 3 & 4 can repeat. 6. First job finishes waiting & gets back the CPU. Fig: Memory layout for a multiprogramming system
36
Contd.. Multi-tasking Also known as time-sharing.
Is a logical extension of multi-programming. CPU switches jobs so frequently that users can interact with each job while it is running. Requires an interactive computer system, for direct communication between user between user & system. Response time should be < 1 second. Allows many users to share the system simultaneously. Each user feels that the entire system is dedicated to his/her use, although its shared by several users.
37
Contd.. Process A program loaded into memory and executing. Job pool
Consists of all processes residing on the disk, waiting for allocation of main memory. Job scheduling Deciding which job has to be brought into memory among several jobs, waiting in the job pool. CPU scheduling Deciding which job to be allocated the CPU, among the set of jobs waiting in the main memory.
38
Contd.. Swapping A memory management technique, where processes are swapped in and swapped out to accommodate sufficient memory. Virtual memory A technique that allows the execution of a process that is not in the main memory. Physical memory Main memory which is actually there in the system. Logical memory Memory, as seen by the user , but not physically there.
39
Unit-I Introduction to Operating Systems What operating systems do
Engineered for Tomorrow Unit-I Introduction to Operating Systems What operating systems do Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
40
Operating System Operations
Interrupt driven by hardware Software error or request creates exception or trap Division by zero, request for operating system service Other process problems include infinite loop, processes modifying each other or the operating system Dual-mode operation Dual-mode operation allows OS to protect itself and other system components User mode and kernel mode Mode bit provided by hardware Provides ability to distinguish when system is running user code or kernel code Some instructions designated as privileged, only executable in kernel mode System call changes mode to kernel, return from call resets it to user
41
Contd.. Fig: Transition from user to kernel mode
42
Contd.. Timer Timer to prevent infinite loop / process hogging resources Set interrupt after specific period Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted time
43
Unit-I Introduction to Operating Systems What operating systems do
Engineered for Tomorrow Unit-I Introduction to Operating Systems What operating systems do Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
44
Process Management Q: Is process and program one and the same ???
A: A program by itself is not a process. A program is a passive entity, like the file contents stored on a disk. A process is an active entity, which will be executed. Process is nothing but a program in execution. Ex: A system task, such as sending output to a printer. A word-processing program run by the user. It is a unit of work within the system. A process needs resources to accomplish its task CPU, memory, I/O, files Initialization data
45
Contd.. The operating system is responsible for the following activities in connection with process management: 1. Creating and deleting both user and system processes 2. Suspending and resuming processes 3. Providing mechanisms for process synchronization 4. Providing mechanisms for process communication 5. Providing mechanisms for deadlock handling Program Counter A Single-threaded process has one program counter , specifying location of next instruction to execute
46
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
47
Memory Management Main memory is a large array of words or bytes.
Each word or byte has its own address. For better CPU utilization and shorter response time, main memory has to accommodate as many programs possible. Choosing a memory management scheme is based on several factors : Hardware design of the system A few memory management techniques are : Paging, swapping, segmentation
48
Contd.. Memory management activities :
1.Keeping track of which parts of memory are currently being used and by whom 2.Deciding which processes (or parts thereof) and data to move into and out of memory 3.Allocating and deallocating memory space as needed
49
Unit-I Introduction to Operating Systems What operating systems do
Engineered for Tomorrow Unit-I Introduction to Operating Systems What operating systems do Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
50
Storage Management File-System Management Mass-Storage Management
Caching
51
Contd.. 1. File-System Management
OS provides uniform, logical view of information storage – File OS implements the concept of file, by managing mass-storage media. magnetic tapes, disks Files are organized into directories for ease of use. Different access permissions are granted to users of files. read, write, append OS activities for file management include : Creating and deleting files and directories Primitives to manipulate files and directories Mapping files onto secondary storage Backup files onto stable (non-volatile) storage media
52
Contd.. 2. Mass-Storage Management
Usually disks used to store data that does not fit in main memory or data that must be kept for a “long” period of time. Compilers, assemblers, word-processors, editors & formatters are stored on disk. Proper management of disk storage is of central importance. Entire speed of computer operation hinges on disk subsystem and its algorithms OS activities Free-space management Storage allocation Disk scheduling
53
Contd.. 3. Caching Information is normally kept in some storage system(main memory or disk). When a piece of information is required, it will be copied into cache. Cache is a form of temporary storage, that is fast and relatively small in size. Requested information will always be checked in cache first. If not found, will be copied to cache for present and future use. Cache management is an important design problem, due to the limited size of cache.
54
Contd.. Performance of Various Levels of Storage
55
Contd.. Migration of Integer A from Disk to Register
Suppose an integer A residing in a file B, on a magnetic disk, has to be incremented by 1. An I/O operation first copies the block containing A from the disk to main memory. Further A, is copied into cache and to an internal register. Now there are 3 copies of A – on main memory, cache & internal register. A is incremented by 1 in the internal register. Now, its value should be updated in remaining two locations as well as on disk. Works fine if a single process is executing. Becomes difficult in multi-processor environment.
56
Contd.. Cache coherency In multi-processor environment, several CPUs will be executing concurrently. Each CPU has its own local cache. Copies of the integer A, may exist simultaneously in several caches. An update to value of A in one cache, should be immediately reflected in other caches. This situation is called Cache coherency.
57
Contd.. I/O Systems One purpose of OS is to hide peculiarities of hardware devices from the user. For example, UNIX hides peculiarities of I/O devices from the OS through an I/O sub-system. I/O subsystem responsible for i) Memory management of I/O including buffering caching spooling ii) General device-driver interface iii)Drivers for specific hardware devices
58
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
59
Protection and Security
Protection – any mechanism for controlling access of processes or users to resources defined by the OS. Security – defense of the system against internal and external attacks Huge range, including denial-of-service, worms, viruses, identity theft, theft of service Systems generally first distinguish among users, to determine who can do what User identities (user IDs, security IDs) include name and associated number, one per user User ID then associated with all files, processes of that user to determine access control Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, file Privilege escalation allows user to change to effective ID with more rights
60
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
61
Distributed Systems A distributed system is a collection of physically separate, possibly heterogeneous, systems networked together. Provides users access to the system resources Increases computation speed, functionality, data availability & reliability. Network is a communications path between 2 or more systems. Local Area Network (LAN) Wide Area Network (WAN) Metropolitan Area Network (MAN) Network Operating System provides file sharing across the network allows different processes on different systems to exchange messages
62
Unit-I Introduction to Operating Systems What operating systems do
Computer system organization Computer system architecture Operating system structure Operating system operations Process management Memory management Storage management Protection and security Distributed system Special purpose systems
63
Special purpose systems
1. Real-time Embedded Systems 2. Multimedia Systems 3. Hand-held Systems
64
Contd.. 1. Real-time Embedded Systems Are designed for specific tasks.
Manufacturing robots, car engines, microwave ovens, Centralized home control system Have little or no user interface. Monitor and manage hardware devices Automobile engines, robotic arms Almost always run on real-time operating systems. Real time systems are used when an application has rigid time requirements. Automobile fuel injection systems, home-appliance controllers, weapon systems
65
Contd.. 2. Multimedia Systems
Other than conventional data, Computer systems are designed to handle multimedia data. Multimedia data – audio & video files How do they differ? Multimedia data must be delivered(streamed), according to certain time constraints(ex: 30 frames per sec). Applications – MP3, DVD movies, video conferencing, short video clips, Internet downloads
66
Contd.. 3. Hand-held systems
Include personal digital assistants(PDAs) and cellular telephones. Challenge for developers limited size of the device processor speed limited I/O Have slow processors, small amounts of memory & small display screens. Memory size – between 1 MB & 1 GB OS must be designed , not to tax the processors. Use wireless technology, such as Bluetooth or
67
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
68
Computing Environments
1. Traditional Computing 2. Client-Server Computing 3. Peer-to-Peer Computing 4. Web-based Computing
69
Contd.. 1. Traditional Computing Traditional computer
Blurring over time Office environment PCs connected to a network, terminals attached to mainframe or minicomputers providing batch and timesharing Now portals allowing networked and remote systems access to same resources Home networks Used to be single system, then modems Now firewalled, networked
70
Contd.. 2. Client-Server Computing Client-Server Computing
Dumb terminals supplanted by smart PCs Many systems now servers, responding to requests generated by clients Compute-server provides an interface to client to request services (i.e., database) File-server provides interface for clients to store and retrieve files
71
Contd.. 3. Peer-to-Peer Computing Another model of distributed system
P2P does not distinguish clients and servers Instead all nodes are considered peers May each act as client, server or both Once a node joins P2P network, it can provide & request services. Availability of services can be determined in 2 ways: i) Node registers its service with central lookup service on network, or ii)Requesting node broadcasts request for service and receives response via discovery protocol
72
Contd.. 4. Web-based Computing Web has become ubiquitous
PCs- most prevalent access devices More devices becoming networked to allow web access. New category of devices to manage web traffic among similar servers: load balancers Use of operating systems like Windows 95, client-side, have evolved into Linux and Windows XP, which can be clients and servers
73
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
74
Operating system services
Operating systems provide an environment for execution of programs and services to programs and users One set of operating-system services provides functions that are helpful to the user: User interface - Almost all operating systems have a user interface (UI). Varies between Command-Line (CLI), Graphics User Interface (GUI), Batch Program execution - The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating error) I/O operations - A running program may require I/O, which may involve a file or an I/O device
75
Contd.. - File-system manipulation - The file system is of particular interest. Programs need to read and write files and directories, create and delete them, search them, list file Information, permission management. Communications – Processes may exchange information, on the same computer or between computers over a network Communications may be via shared memory or through message passing (packets moved by the OS) Error detection – OS needs to be constantly aware of possible errors May occur in the CPU and memory hardware, in I/O devices, in user program For each type of error, OS should take the appropriate action to ensure correct and consistent computing
76
Contd.. Debugging facilities can greatly enhance the user’s and programmer’s abilities to efficiently use the system Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them Many types of resources - Some (such as CPU cycles, main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code Accounting - To keep track of which users use how much and what kinds of computer resources
77
Contd.. Protection and security - The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each other Protection involves ensuring that all access to system resources is controlled Security of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid access attempts If a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as strong as its weakest link.
78
Contd.. A View of Operating System Services
79
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
80
User Operating System Interface
Command Line Interface (CLI) or command interpreter allows direct command entry Sometimes implemented in kernel, sometimes by systems program Sometimes multiple flavors implemented – shells Primarily fetches a command from user and executes it Sometimes commands built-in, sometimes just names of programs If the latter, adding new features doesn’t require shell modification
81
Contd.. Many systems now include both CLI and GUI interfaces
User-friendly desktop metaphor interface Usually mouse, keyboard, and monitor Icons represent files, programs, actions, etc Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder) Invented at Xerox PARC Many systems now include both CLI and GUI interfaces Microsoft Windows is GUI with CLI “command” shell Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells available Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)
82
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
83
System Calls Programming interface to the services provided by the OS
Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM) Why use APIs rather than system calls? (Note that the system-call names used throughout this text are generic)
84
Contd.. Example of System Calls
System call sequence to copy the contents of one file to another file.
85
Contd.. Example of Standard API
Consider the ReadFile() function in the Win32 API—a function for reading from a file A description of the parameters passed to ReadFile() HANDLE file—the file to be read LPVOID buffer—a buffer where the data will be read into and written from DWORD bytesToRead—the number of bytes to be read into the buffer LPDWORD bytesRead—the number of bytes read during the last read LPOVERLAPPED ovl—indicates if overlapped I/O is being used
86
Contd.. System Call Implementation
Typically, a number associated with each system call System-call interface maintains a table indexed according to these numbers The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values The caller need know nothing about how the system call is implemented Just needs to obey API and understand what OS will do as a result call Most details of OS interface hidden from programmer by API Managed by run-time support library (set of functions built into libraries included with compiler)
87
Contd.. API – System Call – OS Relationship
88
Contd.. System Call Parameter Passing
Three general methods used to pass parameters to the OS Simplest: pass the parameters in registers In some cases, may be more parameters than registers Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register This approach taken by Linux and Solaris Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system Block and stack methods do not limit the number or length of parameters being passed
89
Contd.. Parameter Passing via Table
90
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
91
Types of System Calls Process Control File Management
Device Management Information Maintenance Communication Protection
92
Contd.. Process Control System calls can be grouped into six major categories : i) Process control end, abort load, execute create process, terminate process get process attributes, set process attributes wait for time wait event, signal event allocate and free memory ii) File management create file, delete file open, close file read, write, reposition get and set file attributes
93
Contd.. Device management Information maintenance Communications
request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices Information maintenance get time or date, set time or date get system data, set system data get and set process, file, or device attributes Communications create, delete communication connection send, receive messages transfer status information attach and detach remote devices
94
Contd.. Examples of Windows and Unix System Calls
95
Contd.. Example for process and job control in OS: MS-DOS
Single-tasking Shell invoked when system booted Simple method to run program No process created Single memory space Loads program into memory, overwriting all but the kernel Program exit -> shell reloaded
96
Contd.. (a) At system startup (b) running a program
97
Contd.. File Management System calls are used to create and delete files. Requires file name and other file attributes for this operation. System calls can be used to retrieve and reset the values of file/directory attributes. file name, file type, protection codes, accounting information get_file_attribute & set_file_attribute -system calls for retrieving & re-setting file attributes
98
Contd.. Device Management Operations associated with devices are
request for a device release a device read from a device write into a device reposition a device System calls are used to accomplish these device operations.
99
Contd.. Information Maintenance
System calls – used to transfer information between user program and OS. system calls which return system time & date system calls which return system information - no. of current users, OS version, amount of free memory, free disk space Helpful in debugging memory Provides time profile of a program Amount of time, a program executes Provides access to process information get_process_attributes & set_process_attributes A program trace lists each system call, as executed.
100
Contd.. Communication i)Message-passing model
Communicating processes exchange messages to transfer information. A connection has to be made, before any sort of communication. get_hostid & get_processid – system calls to retrieve host id of a system & process id of a process. read_message & write_message – system calls to exchange messages between client & server. ii) Shared-memory model shared_memory_create & shared_memory_attach – system calls to create & gain access to shared memory
101
Contd.. iv) Protection get_permission & set_permission – system calls to manipulate permission settings of files & disks. Allow_user & deny_user – system calls which decide whether a particular user, can access system resource or not.
102
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
103
System Programs Also known as system utilities.
Provide a convenient environment for program development and execution. They can be divided into: File manipulation Status information File modification Programming language support Program loading and execution Communications Application programs Most users’ view of the operation system is defined by system programs, not the actual system calls
104
Contd.. File management - Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories Status information Some ask the system for info - date, time, amount of available memory, disk space, number of users Others provide detailed performance, logging, and debugging information Typically, these programs format and print the output to the terminal or other output devices Some systems implement a registry - used to store and retrieve configuration information File modification Text editors to create and modify files Special commands to search contents of files or perform transformations of the text
105
Contd.. Programming-language support - Compilers, assemblers, debuggers and interpreters sometimes provided Program loading and execution- Absolute loaders, re-locatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language Communications - Provide the mechanism for creating virtual connections among processes, users, and computer systems Allow users to send messages to one another’s screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another
106
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
107
Operating System Design and Implementation
Design Goals Mechanisms and Policies Implementation
108
Contd.. Design Goals Problems associated with designing a system :
Defining goals & specification for a system Requirements may be harder to specify No unique solution to the problem of defining requirements for an OS. User goals and System goals User goals – operating system should be convenient to use, easy to learn, reliable, safe, and fast System goals – operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient
109
Contd.. ii) Mechanisms and Policies
Mechanisms determine – how to do something Policies determine – what will be done Ex: timer - mechanism for ensuring CPU protection Decision – how long, timer has to be set for a particular user is a policy decision Separation of policy and mechanism, important for flexibility. Microkernel-based OS separate policy and mechanism By implementing a basic set of primitive building blocks
110
Contd.. iii) Implementation
Traditionally OS was written in assembly language. Now, OS is mostly written in high-level languages such as C, C++. Linux & Windows XP OS are written, mostly in C. Advantages of using higher-level language code can be written faster code will be compact code is easier to understand & debug OS is easily portable Disadvantages of using higher-level language reduced speed & increased storage requirements Emulator- Programs that duplicate functionality of one system with another system.
111
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
112
Operating System Structure
Simple Structure Layered Approach Microkernels Modules
113
Contd.. Simple Structure
Many commercial OS started with simple structures. Written to provide most functionality in the least space. Example: MS-DOS, original UNIX OS Interface & levels of functionality are not well separated. OS has limited hardware support. Fig: MS-DOS Layer Structure
114
Contd.. Traditional UNIX system architecture
115
Contd.. ii) Layered approach OS is broken into no. of layers.
Bottom layer(layer 0) is the hardware. Highest layer(layer N) is the user interface. Layers are implemented by abstract objects containing data operations that manipulate these data A layer knows only the functionalities provided by the lower layers & not their implementation details. Advantages : simplicity of construction & debugging Disadvantage: Proper definition of layers required Less efficient
116
Contd.. Fig: A Layered Operating System
117
Contd.. iii) Microkernels
Structures the OS by removing all non-essential components from kernel & implements as system & user-level programs. Has a smaller kernel. Main function – Provide communication facility between client program & services running in user space. Message-passing Benefits: Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure Detriments: Performance overhead of user space to kernel space communication
118
Contd.. iv) Modules Most modern operating systems implement kernel modules Kernel has a set of core components Links in additional services during boot time or run time. Ex: Solaris OS, Mac OS X
119
Contd.. Solaris Operating System
The core kernel in Solaris OS has 7 types of loadable kernel modules. Scheduling classes File systems Loadable system calls Executable formats STREAMS modules Miscellaneous Device and bus drivers
120
Contd.. Apple Mac OS X Uses hybrid structures
Consists of Mach microkernel. Top layers – application environments - graphical interface services Lower layer - kernel environment Mach microkernel BSD microkernel
121
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
122
Virtual Machines A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware. A virtual machine provides an interface identical to the underlying bare hardware. The operating system host creates the illusion that a process has its own processor and (virtual memory). Each guest provided with a (virtual) copy of underlying computer
123
Contd.. History and Benefits
First appeared commercially in IBM mainframes in 1972 Fundamentally, multiple execution environments (different operating systems) can share the same hardware Protect from each other Some sharing of file can be permitted, controlled Commutate with each other, other physical systems via networking Useful for development, testing Consolidation of many low-resource use systems onto fewer busier systems “Open Virtual Machine Format”, standard format of virtual machines, allows a VM to run within many different virtual machine (host) platforms
124
Contd.. (a) Non-virtual machine (b) virtual machine
125
Contd.. Simulation Is a virtualization technique
Host system has one architecture & guest system was compiled for different architecture. Benefit Increased program life Explore old architectures on new machines Drawback Performance
126
Contd.. Para-virtualization
Presents guest with system similar but not identical to hardware Guest must be modified to run on para-virtualized hardware Guest can be an OS, or in the case of Solaris 10 applications running in containers Fig: Solaris 10 with Two Containers
127
Contd.. Virtualization Implementation
Difficult to implement – must provide an exact duplicate of underlying machine Typically runs in user mode, creates virtual user mode and virtual kernel mode Timing can be an issue – slower than real machine Hardware support needed More support-> better virtualization i.e. AMD provides “host” and “guest” modes
128
Contd.. Examples VMware Architecture
129
Contd.. 2. Java Virtual Machine
130
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
131
Operating System Generation
Possible to design, code & implement an OS, specifically for one machine at one site. SYSGEN – process of OS configuration for a specific computer site SYSGEN requires hardware information for system configuration What CPU is to be used? How will the boot disk be formatted? How much memory is available? What devices are available? What OS options are desired or what parameter values are to be used? OS is generated in either of the following ways : Modification to an existing source code of the OS. Linking of modules from a pre-compiled library Table-driven system generated at run time.
132
Unit-1(Contd..) Computing environments Operating system services
User-Operating system interface System calls Types of system calls System programs Operating system design & implementation Operating system structure Virtual machines Operating system generation System boot
133
System Boot Booting – starting a computer by loading the kernel
Bootstrap program – code stored in ROM that is able to locate the kernel, load it into memory, and start its execution Operating system must be made available to hardware so hardware can start it Small piece of code – bootstrap loader, locates the kernel, loads it into memory, and starts it Sometimes two-step process where boot block at fixed location loads bootstrap loader When power initialized on system, execution starts at a fixed memory location Firmware used to hold initial boot code
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.