TK 6123 COMPUTER ORGANISATION ARCHITECTURE Lecture 11 Operating

  • Slides: 49
Download presentation
TK 6123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 11: Operating Systems Lecturer : Ass. Prof.

TK 6123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 11: Operating Systems Lecturer : Ass. Prof. Dr. Masri Ayob

A six-level computer 10 March 2021 2

A six-level computer 10 March 2021 2

Early Systems n n Late 1940 s to mid 1950 s No Operating System

Early Systems n n Late 1940 s to mid 1950 s No Operating System Programs interact directly with hardware Two main problems: n n 10 March 2021 Scheduling Setup time 3

Objectives and Functions of OS n Convenience n n Making the computer easier to

Objectives and Functions of OS n Convenience n n Making the computer easier to use Efficiency n 10 March 2021 Allowing better use of computer resources 4

Definition of OS n A collection of computer programs that integrate the hardware resources

Definition of OS n A collection of computer programs that integrate the hardware resources of the computer and make those resources available to the user, n n in a way that allows the user access to the computer in a productive and efficient manner. The OS acts as a system manager: n 10 March 2021 controlling both hardware and software and acting as an interface between the user and the system. 5

Three basic types of OS services n n n Accepts and executes commands and

Three basic types of OS services n n n Accepts and executes commands and requests from the user and from the user’s programs. Manages, loads, and executes programs. Manages the hardware resources of the computer. 10 March 2021 6

Basic Operating System Services n n n The OS provides interfaces for the user

Basic Operating System Services n n n The OS provides interfaces for the user and also for the user’s programs. It provides file support services. It provides I/O support services that can be used by every program. It provides a means for starting the computer. This process is known as bootstrapping or Initial Program Load (IPL). It handles all interrupt processing, including error handling and recovery, as well as I/O and other routine interrupts. 10 March 2021 7

Operating System Services n n It provides services for networking. It provides the tools

Operating System Services n n It provides services for networking. It provides the tools and services for concurrent processing. n n 10 March 2021 As you are aware, a single processor is capable of executing only one instruction at a time. Concurrent processing is the means used to simulate the simultaneous execution of multiple programs to provide multitasking and multiuser support. 8

Operating System Services To support concurrent processing, additional services are required: n n n

Operating System Services To support concurrent processing, additional services are required: n n n 10 March 2021 The operating system provides services that allocate resources, including memory, I/O devices, and CPU time, to programs. It provides program control services to protect users and programs from each other and from outsiders, as well as to make communication between programs possible. It provides information that can be used by the (human) system administrator to tailor and tune the system for optimum performance. 9

Operating System Core Services 10 March 2021 10

Operating System Core Services 10 March 2021 10

The OS occupy space in memory n n Commonly divided into resident and nonresident

The OS occupy space in memory n n Commonly divided into resident and nonresident parts. Some operating system services are critical to the operation of the system and must be resident in memory all the time. Others can be loaded into memory only when they are needed, and executed just like other programs. The critical programs are loaded into memory by the bootstrap loader at start-up time and will remain resident as long as the computer is running. n n 10 March 2021 The bootstrap for most modern computers is stored in ROM. On some computers, part of the resident OS will also be contained in ROM, commonly known as the kernel of the OS. n program that accepts user commands n the routines that handle interrupts and manage resources 11

Starting The Computer System: The Bootstrap n n n When the computer is first

Starting The Computer System: The Bootstrap n n n When the computer is first turned on, the contents of RAM are unknown. However, there must be a program in memory for CPU execution to take place. Therefore, Initial program loading and start-up is performed by using a bootstrap program that is built permanently into a ROM. 10 March 2021 12

STARTING THE COMPUTER SYSTEM: THE BOOTSTRAP 10 March 2021 13

STARTING THE COMPUTER SYSTEM: THE BOOTSTRAP 10 March 2021 13

Types of Operating System n Single-user, single-tasking systems: n n n n Nearly obsolete

Types of Operating System n Single-user, single-tasking systems: n n n n Nearly obsolete Single-user, multitasking systems Multiuser, multitasking systems Distributed systems Network servers Embedded systems Real-time systems 10 March 2021 14

Single-user, multitasking systems n n Allow the user to run several processes at the

Single-user, multitasking systems n n Allow the user to run several processes at the same time. Advantage: user does not have to wait for one task to be completed, but can work on other tasks, leading to higher overall productivity. Window interfaces allow output presentations from several tasks to appear on the screen simultaneously, and provide methods for easy task switching. UNIX, allows users to specify the processes are to execute in the “background’. Background processes can present output to the screen, but only the foreground process can accept input from the keyboard. 10 March 2021 15

Multiuser systems n n Multiuser systems provide additional facilities that allow multiple users to

Multiuser systems n n Multiuser systems provide additional facilities that allow multiple users to share the power of the computer. Large mainframe systems are capable of supporting hundreds of users concurrently. Multiuser systems require additional OS support for multiple I/O terminals, user login files and procedures, passwords, and security. They are still important, although they are gradually being supplanted by networks of smaller computers. 10 March 2021 16

Network servers n n n Is similar to multiuser systems in many respects. The

Network servers n n n Is similar to multiuser systems in many respects. The major burden of program execution has been shifted from the multiuser system to individual clients connected to the server through network. The server may have no direct user facilities of its own, other than those required for management of the system. The server provides file services, print services, and database services to the clients. It may also provide some program execution services for clients, including support for client system startup, particularly on networks with thin clients. 10 March 2021 17

Real-time systems n n Real-time systems are systems in which one or more processes

Real-time systems n n Real-time systems are systems in which one or more processes must be able to access the CPU immediately when required. A real-time system could be viewed as a multitasking system in which the interrupts that cause execution of the real-time program or programs have very high priority, n 10 March 2021 but in many cases, special effort is made to assure that the real-time program can operate within its required time restraints. 18

Embedded control systems n n n Are specialized systems designed to control a single

Embedded control systems n n n Are specialized systems designed to control a single piece of equipment, such as an automobile or microwave oven. The software for embedded control systems is usually provided in ROM. Effectively, an embedded control system is a realtime system that is dedicated to the particular application. 10 March 2021 19

Distributed systems n n n Are rapidly growing on prominence and importance. In a

Distributed systems n n n Are rapidly growing on prominence and importance. In a distributed system, processing power is distributed among the computers in a cluster or network. Even the Internet can be used as a distributed system. Programs, files, and databases may be also be dispersed. Programs may be divided into functional pieces, with execution distributed throughout the network. . NET and CORBA, are two emerging standards designed to expedite this process. 10 March 2021 20

Distributed systems n n n Many modern computing systems include additional OS modules to

Distributed systems n n n Many modern computing systems include additional OS modules to make distributed processing feasible and practical. Distributed Computing Environment (DCE) is an Open. Group standard that establishes a set of features for a distributed computing operating system. The DCE standard is supported and incorporated into the OS of a number of major vendors, including Hewlett. Packard, Sun, and IBM. Open. Group is an organization that promotes open computing by setting standards and certifying products in a number of major areas of computing. UNIX is the best known Open. Group standard. 10 March 2021 21

Basic Single-job Operations n n Process one program at a time. Nearly obsolete. n

Basic Single-job Operations n n Process one program at a time. Nearly obsolete. n n In a single-job system, the user’s program takes precedence. n n E. g. MS-DOS. Once execution of the user’s program is started, the OS is out of the picture. n Unless the user’s program requires a particular service from the OS. n The OS has no specific function to perform and is idle, so the user’s program can run without interruption. Lack of security. The executing program can simply overwrite the resident OS routines if it wishes, which may make restart of the command interpreter impossible or make I/O and file service routines unavailable. 10 March 2021 22

MS-DOS n Has three major memory resident components. n n n 10 March 2021

MS-DOS n Has three major memory resident components. n n n 10 March 2021 A command interface shell, which includes the commands in MS-DOS that must remain memory resident. A set of I/O routines that control each of the I/O devices connected to the system. n Part of the I/O routine set resides in a ROM area known as the BIOS (basic input/output system). A file management system, which locates files, maintains file storage directories and devices, and performs various file manipulation operations. 23

Concurrent Operations n The CPU, in particular, will be idle much of the time,

Concurrent Operations n The CPU, in particular, will be idle much of the time, waiting while I/O operations take place. n n n Disk I/O is very slow compared to the CPU, and most programs must wait until the disk transfer is complete to continue. For interactive systems, most tasks will be idle nearly all the time, waiting for user keyboard input. Modern system provides means and support for manipulating multiple programs on a single CPU, n 10 March 2021 multitasking or multiprogramming. 24

Concurrent Operations n n Multitasking can be applied to a single user, or it

Concurrent Operations n n Multitasking can be applied to a single user, or it can be designed to allow multiple users to share the computer system resources. OS must allocate resources fairly and efficiently to the various tasks and users. n 10 March 2021 These resources include memory, I/O devices, and CPU time. 25

Simple strategies to achieve concurrent processing n n While one program is waiting for

Simple strategies to achieve concurrent processing n n While one program is waiting for I/O to take place, another can be using the CPU to execute instructions. Time-slicing: The CPU may be switched rapidly between different programs, executing a few instructions from each, using a periodic clock-generated interrupt. n Slow down execution of each program. n There is also some OS overhead, as a dispatcher must be invoked at each interrupt to select the next program to receive CPU time. n But the CPU is powerful enough. The process of selecting which program to run at any given instant is known as dispatching. 10 March 2021 26

Sharing the CPU during I/O breaks 10 March 2021 27

Sharing the CPU during I/O breaks 10 March 2021 27

Time-sharing the CPU 10 March 2021 28

Time-sharing the CPU 10 March 2021 28

10 Typical Services And Facilities n n n n n The command processor, application

10 Typical Services And Facilities n n n n n The command processor, application program interface, and user interface. The file management system The input/output control system Process control management and interprocess communication. Memory management Scheduling system Secondary storage management System protection management Network management, communication support, and communication interfaces Support for system administration. Some OS also has a system manager, commonly known as a monitor or supervisor, which handles competing requests or conflicts, and which acts as a general controller and arbiter for the entire system. 10 March 2021 29

User Interface and Command Execution Services n Two common types of user interfaces: n

User Interface and Command Execution Services n Two common types of user interfaces: n n Graphical user interface (GUI). n accepts commands primarily in the form of drop-down menus, mouse movements, mouse clicks. Command line interface (CLI). n relies on typed commands. Regardless of the user interface provided, the command interface provides direct access to various other modules within the operating system. The most often used commands are: n n 10 March 2021 Commands access the file system for file operations and for program loading and execution. Commands for direct access to the I/O system, protection services, network services, and process control services. 30

File Management System (FMS) n n A file may be organized internally into records

File Management System (FMS) n n A file may be organized internally into records or it may simply be a stream of bytes. The FMS provides and maintains the mapping between a file’s logical storage needs and the physical location where it is stored. n n 10 March 2021 Directory structures for each I/O device in the system and tools to access and move around these structures. Tools that copy, move, create and delete files/directory. Information about each file in the system and tools to access that information. Security mechanisms to protect flies and control and limit file access to authorized users. 31

Input/Output Services n The OS includes I/O device driver programs for each device installed

Input/Output Services n The OS includes I/O device driver programs for each device installed on the system. n n n These drivers provide services to the file management system and are also available, through the API, to other programs for their use. The I/O device drivers accept I/O requests and perform the actual data transfers between the hardware and specified areas of memory. Modern systems provide certain I/O drivers with minimal functionality in ROM (usually stored in BIOS), to assure access to critical devices, such as the keyboard, display, and boot disk during the system startup process. 10 March 2021 32

Input/Output Services n Device drivers for newly installed devices are added and integrated into

Input/Output Services n Device drivers for newly installed devices are added and integrated into the OS at the time of installation. n n 10 March 2021 On some systems, the process is manual. On many systems, e. g. the Apple Macintosh, , this process is completely automatic. In Windows, this capability is known as plug-and-play. Many modern systems even make it possible to add and modify devices on the fly, without shutting down the system. n USB and Fire. Wire both provide this capability. 33

Process Control Management n n Every executing program is treated as a process. The

Process Control Management n n Every executing program is treated as a process. The OS performs various functions with process: n n n Scheduling memory management various other services. Processes must often be synchronized, so that processes sharing a common resource do not step on each other’s toes by altering critical data or denying each other needed resources. OS provide communication capability between different processes. Processes may cooperate with each other. 10 March 2021 34

Process Control Management n n Process control management keeps track of each process in

Process Control Management n n Process control management keeps track of each process in memory. It determines the state of each process: whether it is running, ready to run, or waiting for some event, such as I/O to be completed, in order to proceed. It maintains tables that determine the current program counter, register values, assigned files and I/O resources, and other parameters for each process in memory. It coordinates and manages message handling and process synchronization. 10 March 2021 35

Process Control Management n Many modern systems further break the process down into smaller

Process Control Management n Many modern systems further break the process down into smaller units called threads. n n 10 March 2021 A thread is an individually executable part of a process. It shares memory and other resources with all other threads in the same process, but can be scheduled to run separately from other threads. 36

The Memory Management System n n The purpose is to load programs into memory

The Memory Management System n n The purpose is to load programs into memory in such a way as to give each program loaded the memory that it requires for execution. On a single-job system, memory management is simple. n 10 March 2021 Once the OS is loaded, the remainder of memory is available to a program requesting space. 37

The Memory Management System n The memory management system has three primary tasks. n

The Memory Management System n The memory management system has three primary tasks. n n n 10 March 2021 It keeps track of memory, maintaining records, keeps track of available space and prevents programs from reading and writing memory outside their allocated space. It maintains one or more queues of programs waiting to be loaded into memory as space becomes available, based on such program criteria as priority and memory requirements. When space is available, it allocates memory to the programs that are next to be loaded. It also deallocates a program’s memory space when it completes execution. 38

Scheduling n n n Program scheduling is not an issue with a single-tasking system.

Scheduling n n n Program scheduling is not an issue with a single-tasking system. On a multitasking system the OS is responsible for the allocation of CPU time in a manner that is fair to the various programs competing for time, as well as maximizing efficient utilization of the system overall. Two level of scheduling: n n 10 March 2021 High-level scheduling – i. e. First level of scheduling that determines which jobs will be placed into a queue to the system and in what order. Second level: Dispatching - is responsible for the actual selection of processes that will be executed at any given instant by the CPU. n In a multi- threading system, dispatch is done at the thread level, instead of at the process level. 39

Scheduling n n Some processes require extensive amounts of CPU time -CPU bound. Others

Scheduling n n Some processes require extensive amounts of CPU time -CPU bound. Others are mostly I/O operations -I/O bound. It is obviously desirable to dispatch processes in such a way that the system is used effectively. The dispatcher can be preemptive or nonpreemptive. n n The dispatcher for a nonpreemptive system replaces an executing program n only if the program is blocked because of I/O or some other event or n if the program voluntarily gives up the CPU. Preemptive multitasking uses the clock interrupt, to preempt the executing program and to make a fresh decision as to which program executes next. 10 March 2021 40

Scheduling n In general, n n n Nonpreemptive dispatching algorithms apply mostly to older,

Scheduling n In general, n n n Nonpreemptive dispatching algorithms apply mostly to older, batch-oriented systems. Modern dispatchers are predominately preemptive. However, most provide a mechanism to dispatch individual programs nonpreemptively, for programs that must execute to completion without unnecessary interruptions. 10 March 2021 41

Secondary Storage Management n The secondary storage management system attempts to optimize the completion

Secondary Storage Management n The secondary storage management system attempts to optimize the completion of I/O tasks by using algorithms that reorder the requests for more efficient disk usage. n 10 March 2021 For example, it might attempt to read all the requested data blocks from the tracks in one area of the disk before going to read data on tracks at the other end of the disk. 42

Security and Protection Services n n Multitask require security and protection services to protect

Security and Protection Services n n Multitask require security and protection services to protect the OS from user processes—and to protect processes from each other. Multiuser systems require security services to protect the system and user processes from: n n n unauthorized entry to the system, and against unauthorized use of the system, even by authorized users. Each module in the OS includes provisions that protect its assets. n n 10 March 2021 Thus, the file management system would not allow a process to store data on a part of a disk that is being used by another file. Process management would not allow the assignment of an I/O resource that would prevent another process from completing its task. 43

Network and Communications Support Services n n Network and communication services within the OS

Network and Communications Support Services n n Network and communication services within the OS provide the communication software necessary to implement the features and facilities of TCP/IP. It also provide the interface between the communication software and the OS I/O control system that provides access to the network. n 10 March 2021 The I/O control system includes the software drivers for modems, network interface cards, wireless communication cards, and other devices that are used to connect the computer physically and electrically to the network(s). 44

System Administration Support n n Provide a support for system administrator (sysadmin), who is

System Administration Support n n Provide a support for system administrator (sysadmin), who is responsible for maintaining the computer system(s). Some of the important administrative tasks managed by a sysadmin include: n n n 10 March 2021 System configuration and setting group configuration policies Adding and deleting users Controlling and modifying user privileges to meet the changing needs of the users Providing and monitoring appropriate security Managing, mounting, and unmounting file systems Managing, maintaining, and upgrading networks Providing secure and reliable backups Providing and controlling software, installing new software, and upgrading software as required Patching and upgrading the operating systems and other system software Recovering lost data Tuning the system for optithum availability and performance. 45

Os Organization n Three configuration models: n Monolithic configuration n E. g. UNIX n

Os Organization n Three configuration models: n Monolithic configuration n E. g. UNIX n Difficulty is the stability and integrity of the system as a whole. n n n 10 March 2021 Any defect in a program within the kernel can crash the entire system, as can unexpected interactions between different programs in the kernel. Layered or hierarchical configuration Microkernel configuration. 46

Layered or hierarchical configuration n n Sometimes known as a target model, where the

Layered or hierarchical configuration n n Sometimes known as a target model, where the OS is divided into layers. The outermost layers are the ones that are visible to the user; Each layer calls the next innermost layer to request the services that it needs. Disadvantage: the time required to pass the request through intermediate layers to receive services from the innermost layers. Advantage of the layered approach is the stability and integrity that result from a well-structured modular design. 10 March 2021 47

Microkernel configuration n n n Recent innovation in OS design. This is based on

Microkernel configuration n n n Recent innovation in OS design. This is based on a small protected kernel that provides the minimum essential functionality. It is possible to build a microkernel with nothing but message passing, interrupt processing, and minimal memory management. Advantages: possible to create different OS designs simply by changing the service programs that reside outside the microkernel, while maintaining the security and stability of the microkernel. The microkernel approach offers reliability, flexibility, extensibility, and portability. E. g. , Macintosh OS 10 March 2021 48

Thank you Q&A 10 March 2021 49

Thank you Q&A 10 March 2021 49