CSBP315 LN1: Introduction to Operating Systems PDF

Document Details

MarvellousNovaculite8095

Uploaded by MarvellousNovaculite8095

UAEU College of Information Technology

Dr. Nisha Thorakkattu Madathil

Tags

operating systems computer science introduction to OS computer architecture

Summary

This document provides an introduction to operating systems. It covers topics like operating system goals, components, and a historical perspective. The document presents a general overview of operating systems concepts.

Full Transcript

Chapter 1: Introduction Dr. Nisha Thorakkattu Madathil 35 Chapter 1: Introduction What Operating Systems Do Computer-System Organization Computer-System Architecture Operating-System Structure Operating-System Operations Process Management Memory Management...

Chapter 1: Introduction Dr. Nisha Thorakkattu Madathil 35 Chapter 1: Introduction 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 Systems Special-Purpose Systems Computing Environments Open-Source Operating Systems 1.2 Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization 1.3 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware Operating system goals: 1. Help executing user programs (example in the following slide) 2. and make solving user problems easier:  for example the user applications do not need to know about the hardware details and contact the hardware. The OS does the complex job by contacting the hardware. This makes a programmer focus time on application logic rather than 3. Make the computer system convenient (easy) to use by providing a Graphical User Interface 4. Use the computer hardware in an efficient manner 1.4 How the OS Helps in Executing a Program Example: Executing MS Word CPU 6 MS Word 5 1 GUI 2 MS Word 3 4 Operating System RAM Disk 1.5 OS’s Role in Program Execution 1. A user makes an action in the GUI application (i.e. double click):  GUI has an instruction to be used following this double click event. 2. The CPU executes that instruction in the GUI 3. That instruction is a system call (CreateProcess()) to the OS to create the process MS Word 4. The CPU jumps to the OS address space to execute a corresponding service routine 5. The OS communicates with the hard disk 6. And the MS Word Program is moved from the hard disk to the memory. 7. The CPU starts executing MS Word main program. 1.6 OS as an Intermediary As per previous example (Running MS Word from the GUI) To create the process, OS acts as an intermediary between the GUI and the hard disk to move MS Word program GUI Disk OS 1.7 History of OS What were computers like before operating systems were invented? Before Operating Systems, if you wanted to change what the computer was doing, you had to change how the wires were connected. https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.8 First OS ENIAC (Electronic Numerical Integrator and Computer) ENIAC was designed and built for the United States Army to calculate artillery firing tables. 1946, named “Giant Brian” Inputs: Switches and Cables Results will be printed on Punch cards 1.9 To run more than one program at a time, you need a "boss" program that controls all the other programs. Such a boss program is called an operating system. https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.10 Later, instructions were given to the computer with punch cards or magnetic tape. If you wanted to run a different program, you had to wipe out the first program from memory and then load another program into memory. https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.11 Modern OS: UNIX UNIX (trademark) – Multi-tasking multi-user OS. Written in assembly language developed in Bell Labs in 3 Nov. 1971. Starting from fourth generation, Unix is written in C language 1.12 Operating Systems: Microsoft MS-DOS Microsoft’s MS-DOS was one of the first Operating Systems for Personal Computers (PCs). Microsoft Disk Operating System No mouse. Instead, you had to type a lot of special computer commands. Release 12 august 1981 https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.13 Clicking instead of typing commands In the 1980s, operating systems were developed where you could move a mouse around and click on things instead of typing commands. https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.14 Operating System: MINICOMPUTERS Digital Equipment Corporation created several operating systems for its 16-bit PDP-11 machines, RSX-11 family of real-time operating systems. https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.15 Operating System: MICROCOMPUTERS Beginning in the mid- 1970s, a new class of small computers came onto the marketplace. Featuring 8-bit processors along with rudimentary input and output interfaces and as much RAM as practical, these systems started out as kitbased hobbyist computers but soon evolved into an essential business tool. https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.16 Microsoft Windows 1.0 Windows 1.0 was released on November 20, 1985 as the first version of the Microsoft Windows line. It runs as a graphical, 16-bit mult-tasking shell on top of an existing MSDOS installation https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.17 Windows 2000 Windows 2000 is an operating system for use on both client and server computers. Released to manufacturing on December 15, 1999 https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.18 Windows XP The operating system was released to manufacturing on August 24, 2001 https://www.slideshare.net/tarunthakkar/history-of-operating-system?from_action=save 1.19 Little History of XP Mountain 1.20 Windows Vista Windows Vista (codenamed is an operating system by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs and media center PCs. Development was completed on 8, November 2006 1.21 Windows 7, 8, 9 ,10 Windows 7 release date 22 July 2009 1 August 2012 September 2014 1.22 Computer System Structure Computer system can be divided into four components 1. Hardware – provides basic computing resources  CPU, memory, I/O devices 2. Operating system  Controls and coordinates use of hardware among various applications and users 3. 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 4. Users  People, machines, other computers 1.23 Computer System Structure The other way of looking at computer system is  Hardware,  Data  Software  System Programs  Application Programs  Operating System – System Calls – Kernel (Manages the hardware resources) » I/O devices, » File-storage space » CPU time » Memory space 1.24 Four Components of a Computer System 1.25 System Programs System programs provide an environment where programs can be developed and executed. Me In the simplest sense, system programs also provide a bridge Click o between the user interface and system calls. In reality, they are much more complex. Order For example, a compiler is a Opens complex system program. Text Editor 1.26 Operating System Definition OS is a resource allocator (distributing system)  Manages all resources: CPU, memory, disk and all I/O devices needed by the applications.  Decides between conflicting requests for efficient and fair resource use:  Example of 2 applications would like to have access to the same printer, the OS decides on scheduling the requests. OS is a control program  Controls execution of programs to prevent errors and improper use of the computer:  Create Process: The OS copy t he program to be executed from disk to RAM and the CPU executes the program.  Delete Process: The OS requests the CPU to stop executing the process and the process is removed from the memory.  Stop Process: The OS requests the CPU to stop executing the process, but the process remains in RAM  Resume Process: The OS requests the CPU to resume executing the process from the point where it has stopped. 1.27 Operating System Definition (Cont) 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 (ships with the operating system) or an application program 1.28 Computer Startup bootstrap program is loaded at power-up or reboot  Typically stored in ROM or EPROM, generally known as firmware  Initializes all aspects of system  Loads operating system kernel and starts execution A bootstrap program is a small program that loads the operating system when a computer starts. It’s like a “starter” that gets the computer running. 1.29 Computer System Organization Computer-system operation  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 1.30 Computer-System Operation I/O devices and the CPU can execute concurrently (in parallel) Each device controller is in charge of a particular device type Each device controller has a local buffer CPU moves data from/to main memory to/from local buffers, depends whether the I/O is a write operation or a read operation I/O is from the device to local buffer of controller (read operation) or from the local buffer of the controller to the device (write operation) Device controller informs CPU that it has finished its operation by causing an interrupt 1.31 Common Functions of Interrupts Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines Interrupt architecture must save the address of the interrupted instruction Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt A trap is a software-generated interrupt caused either by an error or a user request An operating system is interrupt driven 1.32 Interrupt Handling The operating system preserves (saves) the state of the CPU by storing registers and the program counter Separate segments of code (a service routine) determine what action should be taken for each type of interrupt. Summary: When an interrupt happens, the operating system saves the CPU's state (registers and program counter) so it can continue the task later. It then uses a specific service routine to decide what action to take based on the type of interrupt. 1.33 Interrupt Timeline 1.34 I/O Structure After I/O starts, control returns to user program only upon I/O completion (Synchronous I/O)  Wait instruction idles the CPU until the next interrupt  Wait loop (contention for memory access)  At most one I/O request is outstanding at a time, no simultaneous I/O processing After I/O starts, control returns to user program without waiting for I/O completion (Asynchronous I/O) Device-status table contains entry for each I/O device indicating its type, address, and state  Operating system indexes into I/O device table to determine device status and to modify table entry to include interrupt 1.35 Direct Memory Access Structure Used for high-speed I/O devices able to transmit information at close to memory speeds Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention, increasing the concurrency period and consequently the computer system throughput Only one interrupt is generated per block, rather than the one interrupt per byte 1.36 Storage Structure Main memory – only large storage media that the CPU can access directly Secondary storage – extension of main memory that provides large nonvolatile 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 1.37 Storage Hierarchy Storage systems organized in hierarchy according to:  Speed  Cost  Volatility Caching – copying information into faster storage system; main memory can be viewed as a last cache for secondary storage  Memory  Disk 1.38 Storage-Device Hierarchy ( according to their speed and cost) 1.39 Caching Important principle, performed at many levels in a computer (in hardware, operating system, software) Information in use copied from slower to faster storage temporarily Faster storage (cache) checked first to determine if information is there  If it is, information used directly from the cache (fast)  If not, data copied to cache and used there Cache smaller than storage being cached  Cache management important design problem  Cache size and replacement policy 1.40 Computer-System Architecture Most systems use a single general-purpose processor (PDAs through mainframes)  Most systems have special-purpose processors as well Multiprocessors systems growing in use and importance  Also known as parallel systems, tightly-coupled systems  Advantages include 1. Increased throughput 2. Economy of scale 3. Increased reliability – graceful degradation or fault tolerance  Two types 1. Asymmetric Multiprocessing (Not all CPUs are equal) 2. Symmetric Multiprocessing (All CPUs are equal) 1.41 How a Modern Computer Works 1.42 Symmetric Multiprocessing Architecture 1.43 A Dual-Core Design 1.44 Clustered Systems Like multiprocessor systems, but multiple systems working together  Usually sharing storage via a storage-area network (SAN)  Provides a high-availability service which survives failures  Asymmetric clustering has one machine in hot-standby mode(does nothing but monitor the active server)  Symmetric clustering has multiple nodes running applications, monitoring each other  Some clusters are for high-performance computing (HPC)  Applications must be written to use parallelization 1.45 Operating System Structure Multiprogramming needed for efficiency  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  A subset of total jobs in system is kept in memory  One job selected and run via job scheduling (organizing the multiple jobs)  When it has to wait (for I/O for example), OS switches to another job Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing  Response time should be < 1 second  Each user has at least one program executing in memory process  If several jobs ready to run at the same time  CPU scheduling  If processes don’t fit in memory, swapping moves them in and out to run  Virtual memory allows execution of processes not completely in memory 1.46 Memory Layout for Multiprogrammed System 1.47 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 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 1.48 Transition from User to Kernel Mode 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 1.49 Types of OS: Batch Operating System Batch (group) Operating System – This type of operating system does not interact with the computer directly. There is an operator which takes similar jobs having same requirement and group them into batches. It is the responsibility of operator to sort the jobs with similar needs. 1.50 Types of OS: Batch Operating System Advantages of Batch Operating System:  It is very difficult to guess or know the time required by any job to complete. Processors of the batch systems know how long the job would be when it is in queue  Multiple users can share the batch systems  The idle time for batch system is very less  It is easy to manage large work repeatedly in batch systems Disadvantages of Batch Operating System:  The computer operators should be well known with batch systems  Batch systems are hard to debug  It is sometime costly  The other jobs will have to wait for an unknown time if any job fails 1.51 Types of OS: Batch Operating System Ex  Payroll System,  Bank Statements etc. 1.52 Types of OS: Time-Sharing Operating Systems Each task is given some time to execute, so that all the tasks work smoothly. Each user gets time of CPU as they use single system. These systems are also known as Multitasking Systems. The task can be from single user or from different users also. After this time interval is over OS switches over to next task. 1.53 Types of OS: Time-Sharing Operating Systems Advantages of Time-Sharing OS:  Each task gets an equal opportunity  Less chances of duplication of software  CPU idle time can be reduced Disadvantages of Time-Sharing OS:  Reliability problem  One must have to take care of security and integrity of user programs and data  Data communication problem 1.54 Types of OS: Time-Sharing Operating Systems Multics, early first time-sharing OS  Multics is an influential early time-sharing operating system which is based on the concept of a single-level memory. Virtually all modern operating systems were heavily influenced by Multics – often through Unix, which was created by some of the people who had worked on Multics Unix etc. What else? 1.55 Types of OS: Distributed Operating System Getting popular Various autonomous interconnected computers communicate each other using a shared communication network. Independent systems possess their own memory unit and CPU. These are referred as loosely coupled systems or distributed systems 1.56 Types of OS: Distributed Operating System The major benefit of working with these types of operating system is that it is always possible that one user can access the files or software which are not actually present on his system but on some other system connected within this network i.e., remote access is enabled within the devices connected in that network. Advantages of Distributed Operating System:  Failure of one will not affect the other network communication, as all systems are independent from each other  Electronic mail increases the data exchange speed  Since resources are being shared, computation is highly fast and durable  Load on host computer reduces  These systems are easily scalable(editable (you can add)) as many systems can be easily added to the network  Delay in data processing reduces 1.57 Types of OS: Network Operating System Runs on Server and provide the capability to manage data, users, groups, security, applications, and other networking functions. Shared access of files, printers, security, applications, and other networking functions over a small private network (LAN). All users know others configurations, e.g. their individual connections etc. and that’s why these computers are popularly known as tightly coupled systems. 1.58 Types of OS: Network Operating System Advantages of Network Operating System:  Highly stable centralized servers  Security concerns are handled through servers  New technologies and hardware up-gradation are easily integrated to the system  Server access are possible remotely from different locations and types of systems Disadvantages of Network Operating System:  Servers are costly  User has to depend on central location for most operations  Maintenance and updates are required regularly 1.59 Types of OS: Network Operating System Examples of Network Operating System are:  Microsoft Windows Server 2003,  Microsoft Windows Server 2008,  UNIX,  Linux,  Mac OS X,  Novell NetWare, and  BSD etc. https://www.youtube.com/watch?v=u v47Q773D3M 1.60 Types of OS: Real-Time Operating System These types of OSs serves the real-time systems. The time interval required to process and respond to inputs is very small. This time interval is called response time. Real-time systems are used when there are time requirements are very strict like missile systems, air traffic control systems, robots etc. Hard Real-Time Systems:  Instant response  Automatic parachutes or air bags  Virtual memory is almost never found in these systems. Soft Real-Time Systems: These OSs are for applications where for time-constraint is less strict. 1.61 Types of OS: Real-Time Operating System Advantages of RTOS:  Maximum Consumption: Maximum utilization of devices and system, thus more output from all the resources  Task Shifting: Time assigned for shifting tasks in these systems are very less. For example in older systems it takes about 10 micro seconds in shifting one task to another and in latest systems it takes 3 micro seconds.  Focus on Application: Focus on running applications and less importance to applications which are in queue.  Real time operating system in embedded system: Since size of programs are small, RTOS can also be used in embedded systems like in transport and others.  Error Free: These types of systems are error free.  Memory Allocation: Memory allocation is best managed in these type of systems. 1.62 Types of OS: Real-Time Operating System Disadvantages of RTOS:  Limited Tasks: Very few tasks run at the same time and their concentration is very less on few applications to avoid errors.  Use heavy system resources: Sometimes the system resources are not so good and they are expensive as well.  Complex Algorithms: The algorithms are very complex and difficult for the designer to write on.  Device driver and interrupt signals: It needs specific device drivers and interrupt signals to response earliest to interrupts.  Thread Priority: It is not good to set thread priority as these systems are very less prone to switching tasks. 1.63 Types of OS: Real-Time Operating System Examples of Real-Time Operating Systems are:  Scientific experiments,  medical imaging systems,  industrial control systems,  weapon systems,  robots,  air traffic control systems, etc. https://www.youtube.com/watch?v=a eP0A67eNEg 1.64 Process Management A process is a program in execution (Instance of a program). It is a unit of work within the system. Program is a passive entity, process is an active entity. Process needs resources to accomplish its task such as:  CPU, memory, I/O, files  Initialization data Process termination requires reclaim of any reusable resources Single-threaded process has one program counter specifying location of next instruction to execute  Process executes instructions sequentially, one at a time, until completion Multi-threaded process has one program counter per thread Process = Program code + state of all the threads executing within the program. Typically system has many processes, some user, some operating system running concurrently on one or more CPUs  Concurrency by multiplexing the CPUs among the processes / threads 1.65 Process Management Activities 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 1.66 Memory Management All data in memory before and after processing All instructions in memory in order to execute Memory management determines what is in memory when  Optimizing CPU utilization and computer response to users Memory management activities:  Keeping track of which parts of memory are currently being used and by whom  Deciding which processes (or parts thereof) and data to move into and out of memory  Allocating and deallocating memory space as needed  Swapping processes between main and 2ndary memories 1.67 Storage Management OS provides uniform, logical view of information storage  Abstracts physical properties to logical storage unit - file  Each medium is controlled by device (i.e., disk drive, tape drive)  Varying properties include access speed, capacity, data- transfer rate, access method (sequential or random) File-System management  Files usually organized into directories  Access control on most systems to determine who can access what  OS activities 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 1.68 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 Proper management 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 Some storage need not be fast  Tertiary storage (external storage devices) includes optical storage, magnetic tape  Still must be managed  Varies between WORM (write-once, read-many-times) and RW (read-write) 1.69 Managing is everything 1.70 Performance of Various Levels of Storage Movement between levels of storage hierarchy can be explicit or implicit 1.71 Migration of Integer A from Disk to Register Multitasking environments must be careful to use most recent value, no matter where it is stored in the storage hierarchy Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent value in their cache  Cache coherence is the regularity or consistency of data stored in cache memory. Maintaining cache and memory consistency is imperative for multiprocessors or distributed shared memory (DSM) systems. Distributed environment situation even more complex  Several copies of a datum can exist  Various solutions covered in Chapter 17 1.72 I/O Subsystem One purpose of OS is to hide peculiarities of hardware devices from the user I/O subsystem responsible for  Memory management of I/O including buffering (storing data temporarily while it is being transferred), caching (storing parts of data in faster storage for performance), spooling (the overlapping of output of one job with input of other jobs)  General device-driver interface  Drivers for specific hardware devices 1.73 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 1.74 Cooperating Processes Independent process cannot affect or be affected by the execution of another process Cooperating process can affect or be affected by the execution of another process Advantages of process cooperation:  Information sharing  Computation speed-up  Modularity (complete each other)  Convenience (easy to use) 1.75 Client-Server Computing An architecture in which each process is either a client or a server  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 1.76 Client-Server Computing  Clients  Applications run on computers.  Rely on servers for:  Files  Processing power  Devices  Examples 1.77 Client-Server Computing  Servers  Processes that manage network resources.  Disk drivers (file servers)  Printer (print servers)  Processes that process requests from clients.  Examples The Services like GMail, Facebook, Yahoo, Amazon, Google act as Servers Web or mobile client like login account of GMail or Facebook or Yahoo will act as Client. 1.78 Client-Server Computing  Advantages  Improved data sharing  Integration of services  Shared resources amongst different devices  Data processing capability  Easy maintenance  Security  Disadvantage  Overloaded servers  Impact of centralized architecture 1.79 Client-Server Computing  References  Wikipedea: https://en.wikipedia.org/wiki/Client%E2 %80%93server_model  Link to video: https://www.youtube.com/watch?v=SwL dKeC8scE  Tutorial: http://clientserverarch.blogspot.ae/2013 /03/introduction-to-clientserver-computi ng.html 1.80 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  Node must join P2P network  Registers its service with central lookup service on network, or  Broadcast request for service and respond to requests for service via discovery protocol  Examples include Napster and Gnutella 1.81 Web-Based Computing Web has become ubiquitous PCs most prevalent 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. Examples:  Email applications, word processors, spreadsheet apps, and a host of other office productivity tools.  Google Docs, Sheets.. 1.82 Open-Source Operating Systems Operating systems made available in source-code format rather than just binary closed-source Counter to the copy protection and Digital Rights Management (DRM) movement Started by Free Software Foundation (FSF), which has “copyleft” GNU Public License (GPL) Examples include GNU/Linux, BSD UNIX (including core of Mac OS X), and Sun Solaris 1.83 End of Chapter 1

Use Quizgecko on...
Browser
Browser