4 IntroductionComputer software can be divided roughly into two kinds:System software:- which manages the operation of the computer itself.Application programs:-which performs the actual work the user wants.The most important system program is the operating system (OS), whose job is to control all the computer's resources and provide a base upon which the application programs can be written.The OS controls and coordinates the use of the hardware among the various system programs and application programs for a various users.It simply provides an environment with which other programs can do useful work.Sem II rd year G5-G8

5 Definition and Objectives of an Operating SystemDefinition: Os is a System program thatcontrols execution of programs to prevent errors and improper use of the computer.acts as an interface between the hardware and its users.Objectives:Convenience – Top Down View – Virtual MachineExtending the real hardware and acting as a Virtual MachineHiding the truth about the hardware from the userProviding the user a convenient interface which is easier to programEfficiency – Bottom Up View – Resource ManagerProviding an orderly and controlled allocation of resourcesImproving resource utilizationManages all resourcesSem II rd year G5-G8

6 Operating system goals can be summarized as:Ability to EvolveAdaptability to new changesHardware upgrades/New types of hardwareNeed of new servicesEasy fixes of latent errors Operating Systems and Computer Architecture are historically tied because architectural changes affect bothstructure of Operating Systemsperformance of Operating SystemsOperating system goals can be summarized as:Execute user programs and make solving user problems easier.Make the computer system convenient to use.Use the computer hardware in an efficient manner.Sem II rd year G5-G8

7 Computer System StructureComputer system can be divided into four componentsHardware – provides basic computing resourcesCPU, memory, I/O devicesOperating systemControls and coordinates use of hardware among various applications and usersApplication programs – define the ways in which the system resources are used to solve the computing problems of the usersWord processors, compilers, web browsers, database systems, video gamesUsersPeople, machines, other computersSem II rd year G5-G8

9 a. User view Computer System…A computer system can be viewed as a system consisting of hardware, software and data.Os provides the means for proper use of these resourcesAn Os is like a government, which does not perform any useful function by itself. But it simply provides an environment so that other programs can perform useful work.Operating system role’sTwo viewsa. User viewThe user view of a computer system depends on the types of interfaces being used.One PC-one user: -a single user monopolizes all the resources that a single PC has. Objective-maximizes work. but no resource sharingSem II rd year G5-G8

10 3. Users at workstations connected to networks of other workstations Computer System Stru….2. Users at terminals:-a user sits at a terminal connected to a main frame or a minicomputer. Other users can have access to this same mainframe. Users also may exchange information.objective:-maximizes resource-sharing(the OS must assure that no individual user consumes more than its fair share)3. Users at workstations connected to networks of other workstationsUsers have individual resources at their disposal but also share resources such as networks and servers-file, printers ,etc. so an OS designed for such purpose must compromise b/n individual usability & resource utilization.4. Handheld computers:-most are standalone & for individual use. They might be wired/less/. OS designed for these systems maximizes individual usability but performance per amount of power must be an issue.Sem II rd year G5-G8

11 System view:-from the computers point of viewComputer System Stru….System view:-from the computers point of viewThe OS is most intimately involved program with the hardwareThe OS is a resource manager. Since it manages CPU time, memory space, storage space ,I/O devices and so on which are used by the computer system in solving problem. OS manages d/t requests that may conflict with each other and assigns them the available resources fairly.The OS can deallocate a resource when the program to which it is allocated either terminates or makes an explicit request for deallocation.Alternatively, it can deallocate a resource by force. This actions is called resource preemption.System resources may be preempted by an OS to enforce fairness in their use by programs, or to realize certain system-level goals.Sem II rd year G5-G8

12 Resources can be shared by a set of programs in two ways: A preempted program can not execute unless the preempted resource unit, or some resource unit of the same resource class, is allocated to it.Resources can be shared by a set of programs in two ways:Sequential sharing:- a resource is allocated for exclusive use by a program. When the resource is deallocated, it is marked as free in the resource table so that it will be allocated to another program.Concurrent sharing:- two or more programs can concurrently use the same resource.The CPU can be shared only in sequential manner where as the memory can be shared in both sequential as well as pool-based manner.Computer System Stru….Sem II rd year G5-G8

13 Computer System Stru….2. OS is a control program. It manages the execution of user programs to prevent errors and improper use of the computer. It is especially concerned with the operation and control of I/O devices.The fundamental goal of a computer system is to execute user programs and make solving user problems easier. For this purpose computer hardware was constructed. But bare hardware is not used for this purpose. This leads to the development of application programs.Application programs have certain common operations, such as controlling I/O devices. The common functions of controlling and allocating resources are brought together into a piece of software called OS.Sem II rd year G5-G8

14 Operating System DefinitionOS is a resource allocatorManages all resourcesDecides between conflicting requests for efficient and fair resource useOS is a control programControls execution of programs to prevent errors and improper use of the computerNo universally accepted definition“Everything a vendor ships when you order an operating system” is good approximationBut 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 programSem II rd year G5-G8

16 Examples of where you will find OSsServers (Mainframe Computers):- specialized for processing large volumes of requests for a given service.Generally has a large number of necessary resources.Desktops:- specialized for single-user (or limited number of users).Generally has a GUI that is integral to system softwaredesigned to minimize response time to user requestsMay run several different types of operating systems (Windows, MacOS, UNIX, Linux).Embedded Systems:- specialized for managing a limited number of resources such as power, memory, I/O speed.PDAs, cell phones, smart cards, automobiles.Sem II rd year G5-G8

17 Examples of where you will find …Clustered (Message-passing multicomputer) Systems:- are interconnected by a high-speed interconnection fabric. Each processor has its own local memory and they communicate using the interconnect.May share secondary storage.Real-time Systems:- Specialized systems that must meet stringent performance and behavior requirements.RTOS is one that must react to inputs and responds to them quickly.Distributed SystemsDistribute the computation among several physical processors.Distributed OS runs on and controls the resources of multiple machines.Sem II rd year G5-G8

18 Examples of where you will find …Parallel SystemsMultiprocessor systems with more than on CPU in close communication.Multiprogrammed Batch SystemSeveral jobs are kept in main memory at the same time, and the CPU is multiplexed among them.Time-Sharing Systems–Interactive ComputingTime-sharing systems supports interactive users.It is also called multitasking and it is a logical extension of multiprogramming.Time-sharing systems uses CPU scheduling and multiprogramming to provide an economical interactive system of two or more users.Here each user is given a time-slice for executing his job in round robin fashion. Job continues until the time-slice ends.Sem II rd year G5-G8

19 Computer System OrganizationComputer Startupbootstrap program is loaded at power-up or rebootTypically stored in ROM or EPROM, generally known as firmwareInitializes all aspects of systemLoads operating system kernel and starts executionComputer System OrganizationComputer-system operationOne or more CPUs, device controllers connect through common bus providing access to shared memoryConcurrent execution of CPUs and devices competing for memory cyclesSem II rd year G5-G8

20 Computer-System OperationI/O devices and the CPU can execute concurrently.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 buffersI/O is from the device to local buffer of controller.Device controller informs CPU that it has finished its operation by causing an interrupt.Sem II rd year G5-G8

21 Storage StructureMain memory – the 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 materialDisk surface is logically divided into tracks, which are subdivided into sectors.The disk controller determines the logical interaction between the device and the computer.Sem II rd year G5-G8

23 CachingImportant principle, performed at many levels in a computer (in hardware, operating system, software)Information in use copied from slower to faster storage temporarilyFaster storage (cache) checked first to determine if information is thereIf it is, information used directly from the cache (fast)If not, data copied to cache and used thereCache smaller than storage being cachedCache management important design problemCache size and replacement policySem II rd year G5-G8

24 Performance of Various Levels of StorageMovement between levels of storage hierarchy can be explicit or implicitSem II rd year G5-G8

25 Computer system structureA computer system can be categorized into a number of ways based on the number of general purpose processors used.1. single processor systemsmost systems belongs to this categoryranges from PDAs to main frameshave one main CPU capable of executing a general purpose instruction set, including instructions from user process.The use of a special purpose processor does not change a single- processor system into multiprocessor.Sem II rd year G5-G8

26 2. Multiprocessor systemComputer system structure(cont)2. Multiprocessor systemalso called parallel systems or tightly coupled systemshave 2 or more general purpose processors in close communications, sharing the computer bus and sometimes the clock, memory and peripherals.Has three main advantagesIncreased throughputEconomy of scaleIncreased reliabilityi. increased throughput.Increasing number of processors =>more work done in less time.The speedup ratio of N-processors is not N. Rather it is less than N(cause- the overhead incurred in keeping all parts working together plus contention for shared resources)Sem II rd year G5-G8

27 Computer system structure(cont)ii. Economy of scale-multiprocessor systems cost less than equivalent multiple single processor systems, because they can share peripherals, mass storage, and power supplies .If several programs operates on the same set of data, it is cheaper to store those data on one disk and to have all the processors share them than to have many computers with local disks and many copies of the data.iii. Increased Reliability.Functions being distributed properly among several processors, failure of one processor will not halt the system, only slow it down.If 10 processors are there and if one fails, then each of the remaining 9 processors can pickup a share of the work of the failed processor.==>the entire system runs only 10% slower, rather than failing altogether.Sem II rd year G5-G8

28 Computer system structure(cont)The ability to continue providing proportional service to the level of surviving hardware is called graceful degradation.(Exc. Compare it with fault tolerant).Multiprocessors are two typesAsymmetric multiprocessorsSymmetric multiprocessorsEach processor is assigned a specific task. A master processor controls the system; the other processors either look to the master for instruction or have predefined tasks.Defines a master-slave relationshipsThe master processor schedules and allocates work to the slave processors.Sem II rd year G5-G8

29 Computer system structure(cont)Symmetric multiprocessors(SMP)Each processor performs all tasks within the operating system.SMP-means all processors are peersbenefit-many processes can run simultaneously.3. clustered Systemsis a type of multi-CPU systemHave multiple CPUs to accomplish computational work(like multiprocessor systems)They are composed of two or more individual systems coupled together(difference with multiprocessors)They share storages and are closely liked via a LAN or faster interconnect such as InfiniBand.Provide high availability service(service will continue even if one or more systems in the cluster fail)Sem II rd year G5-G8

30 Computer system structure(cont)Clustering can bea. asymmetric modeOne machine is in hot-stand-by mode, while the other is running the application.The HSM host machine does nothing but actively monitors the server. If server fails, the HSM become the active server.b. Symmetric modeTwo or more hosts are running applications, and are monitoring each other.More efficient as it uses all of the available hardware.Sem II rd year G5-G8

31 Operating System StructureMultiprogramming needed for efficiencySingle user cannot keep CPU and I/O devices busy at all timesMultiprogramming organizes jobs (code and data) so CPU always has one to executeA subset of total jobs in system is kept in memoryOne job selected and run via job schedulingWhen 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 computingResponse time should be < 1 secondSem II rd year G5-G8

32 Each user has at least one program executing in memory process Operating System Structure(cont)Each user has at least one program executing in memory processIf several jobs ready to run at the same time  CPU schedulingIf processes don’t fit in memory, swapping moves them in and out to runVirtual memory allows execution of processes not completely in memoryVM enables users to run programs that are larger than actual physical memorySem II rd year G5-G8

33 Memory Layout for Multiprogrammed SystemProcessor switches from one process to an other when ever an I/O event or Timer interrupt occursFigure :-4 processes are loaded to memory in Multiprogramming systemsSem II rd year G5-G8

34 Operating System ComponentsAll OSs have similar core componentsShell(User level)Kernel (core)The shell exposes functions to users and applicationsPiece of software that provides an interface for users using either command-line or graphical interfaceActs as an interface between the user and the kernel.Normally reside on disks and are loaded into memory when needed.The kernel (nucleus) interacts with hardware devicesAllocates time & memory to programs and handles the file store & communication in response to system callsReside in memory all the time and is the hub of the OSSem II rd year G5-G8

35 Operating-System OperationsModern OS are interrupt driven.Software error or request creates exception or trapDivision by zero or invalid memory access.Other process problems include infinite loop, processes modifying each other or the operating systemDual-mode operation allows OS to protect itself and other system componentsUser mode and kernel modeMode bit provided by hardwareProvides ability to distinguish when system is running user code or kernel codeSome instructions designated as privileged, only executable in kernel modeSystem call changes mode to kernel, return from call resets it to userSem II rd year G5-G8

36 Set interrupt after specific period During a transition from User to Kernel Mode an infinite loop may occur.To prevent infinite loop / process hogging resources a Timer is used.how?Set interrupt after specific periodOperating system decrements counterWhen counter zero generate an interruptSet up before scheduling process to regain control or terminate program that exceeds allotted timeA computer system executing tasks on behalf of a user applications, the system is in user mode.When a user application requests service from an OS(via system call) it is in kernel mode.At system boot time, the hardware starts in kernel mode. Then the OS is loaded and starts execution of user applications in a user mode.System call provide the means for a user program to ask the OS to perform tasks reserved for the OS on the user’s programs behalf.Sem II rd year G5-G8

37 Operating system servicesUser interface:-command line or GUIProgram execution:-I/O operationsFile System ManipulationsCommunicationError detectionResource allocationAccountingProtection and SecuritySem II rd year G5-G8

38 Operating System ServicesBelow are some of the main services of the operating system that provides helpful functions to the user.User interface - Almost all operating systems have a user interface (UI)Varies between Command-Line (CLI), Graphics User Interface (GUI), BatchProgram 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.File-system manipulation - programs need to read and write files and directories, create and delete them, search them, list file Information, permission management.Sem II rd year G5-G8

39 Operating System Services (Cont.)Communications – Processes may exchange information, on the same computer or between computers over a networkCommunications may be via shared memory or through message passing (packets moved by the OS)Error detection – OS needs to be constantly aware of possible errorsAn error may occur in the CPU and memory hardware, in I/O devices, in user programFor each type of error, OS should take the appropriate action to ensure correct and consistent computingDebugging facilities can greatly enhance the user’s and programmer’s abilities to efficiently use the systemResource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated Fairley to each of themSem II rd year G5-G8

40 Operating System Services (Cont.)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 resourcesProtection 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 otherProtection involves ensuring that all access to system resources is controlledSecurity of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid access attemptsIf a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as strong as its weakest link.Sem II rd year G5-G8

43 System Callsare ready-made functions comprises of frequently used code(such as device controlling codes-which may waste programmers time if programmers write them)Provide an interface to allow user-level processes to request services of the operating system.Typically written in a high-level language (C or C++), but some are written in assembly and machine languages.The next slide shows the sequence of system calls used in copying data from one file to another file.Sem II rd year G5-G8

44 Example of System CallsSystem call sequence to copy the contents of one file to another file.even simple programs make heavy use of the operating system. But most programmers do not see this level of detail.Fig;-Example of how system calls are used.Sem II rd year G5-G8

45 Usually application developers design programs based on Application Programming Interface(APIs).APIs specify a set of functions that are available to an application programmer, including the parameters used for each function including the return type a programmer expect.Most programs access system calls via APIs, rather than direct system call.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 did an application programmer prefer programming according to APIs instead of invoking direct system calls?Portability:-program designed in APIs can compile and run on other systems sporting the same APIs.Convenience : Actual sys calls are usually more detail and difficult to work with than the API available to app programmer.Sem II rd year G5-G8

46 Example of Standard APIConsider the ReadFile() function in theWin32 API—a function for reading from a fileA description of the parameters passed to ReadFile()HANDLE file—the file to be readLPVOID buffer—a buffer where the data will be read into and written fromDWORD bytesToRead—the number of bytes to be read into the bufferLPDWORD bytesRead—the number of bytes read during the last readLPOVERLAPPED ovl—indicates if overlapped I/O is being used(Note that the system-call names used throughout this presentation are generic, each operating system has its own name for each system call)Sem II rd year G5-G8

47 System Call ImplementationTypically, a number associated with each system callSystem-call interface maintains a table indexed according to these numbersThe system call interface invokes intended system call in OS kernel and returns status of the system call and any return valuesThe caller need know nothing about how the system call is implementedJust needs to obey API and understand what OS will do as a result callMost details of OS interface hidden from programmer by APIManaged by run-time support library (set of functions built into libraries included with compiler)Sem II rd year G5-G8

50 - read(fd,&buffer,nbytes); Example:-to make clear how a systems call works, consider a read system call with signature as follows.- read(fd,&buffer,nbytes);A call from a C program might look like this;- count=read(fd,&buffer,nbytes);System calls are performed in a number of steps: - to see the steps consider the read system call discussed above.Sem II rd year G5-G8

51 System Call Parameter PassingOften, more information is required than simply identity of desired system callExact type and amount of information vary according to OS and callThree general methods are used to pass parameters between a running program and the operating system.Simplest: pass the parameters in registersIn some cases, may be more parameters than registersParameters stored in a block, or table, in memory, and address of block passed as a parameter in a registerThis approach taken by Linux and SolarisParameters placed on stack:- parameters are pushed onto the stack by the program and popped off the stack by the operating systemBlock and stack methods do not limit the number or length of parameters being passedExplain how parameters are exchanged between procedures during a system callSem II rd year G5-G8

54 System Programs(cont)System programs provide a convenient environment for program development and execution. The can be divided into:File manipulationStatus informationFile modificationProgramming language supportProgram loading and executionCommunicationsApplication programsMost users’ view of the operation system is defined by system programs, not the actual system callsSem II rd year G5-G8

55 Provide a convenient environment for program development and executionSystem Programs(cont)Provide a convenient environment for program development and executionSome of them are simply user interfaces to system calls; others are considerably more complexFile management - Create, delete, copy, rename, print, dump, list, and generally manipulate files and directoriesStatus informationSome ask the system for info - date, time, amount of available memory, disk space, number of usersOthers provide detailed performance, logging, and debugging informationTypically, these programs format and print the output to the terminal or other output devicesSome systems implement a registry - used to store and retrieve configuration informationSem II rd year G5-G8

57 Operating System Design and ImplementationDesign and Implementation of OS not “solvable”, but some approaches have proven successfulInternal structure of different Operating Systems can vary widelyStart by defining goals and specificationsAffected by choice of hardware, type of systemUser goals and System goalsUser goals – operating system should be convenient to use, easy to learn, reliable, safe, and fastSystem goals – operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficientSem II rd year G5-G8

58 System ImplementationTraditionally written in assembly language, operating systems can now be written in higher-level languages.Code written in a high-level language:can be written faster.is more compact.is easier to understand and debug.An operating system is far easier to port (move to some other hardware) if it is written in a high-level language.Sem II rd year G5-G8

59 System Generation (SYSGEN)Operating systems are designed to run on any of a class of machines; the system must be configured for each specific computer site.SYSGEN program obtains information concerning the specific configuration of the hardware system.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.Sem II rd year G5-G8

60 Operating System StructureModern operating systems are complex and consists of different components.These components of modern systems are interconnected and melded to the kernel.five different OS structures have been tried so far.The five designs are:monolithic systemslayered systemsvirtual machinesMicrokernel’s andmodulesSem II rd year G5-G8

61 Monolithic Systems Not divided into moduleswritten to provide the most functionality in the least spaceNot divided into modulesIt is a simple structure.The operating system is written as a collection of procedures, each of which can call any of the other ones whenever it needs to.When this technique is used, each procedure in the system has a well-defined interface in terms of parameters and results, and each one is free to call any other one, if the latter provides some useful computation that the former needs.In this approach, software is characterized by the fact that different parts of the software know each other’s internal details and freely use this knowledge in their functioning (no data hiding).Sem II rd year G5-G8

62 Testing and debugging is difficult.Monolithic Systems(cont)The following are draw backs of monolithically structured OS:Each OS component is machine dependent, that is, each component has to interface with the computer hardware (bare machine).This made OS development difficult, time consuming and expensive.A change made in one monolithic software component can affect its other components. This is due to the reason that different components of the monolithic software share each other’s data.Testing and debugging is difficult.MS-DOS is an example of such OSs.Sem II rd year G5-G8

64 Layered Approach(Design)Were developed in which functions are organized hierarchically and interaction only takes place between adjacent layers.The operating system is divided into a number of layers (levels), each built on top of lower layers.The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface.With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers.In layered approach, most or all of the layers execute in kernel mode.The basic discipline in layered OS design is that the routines of one layer use only the facilities of the layer directly below it, that is, no layer in the structure can be bypassed.Sem II rd year G5-G8

65 Layered Approach(contThe OS is designed to organize the operating system as a hierarchy of layers, each one constructed upon the one below it.The first system constructed in this way was the THE system built at the Technische Hogeschool Eindhoven in the Netherlands by E. W. Dijkstra and his students.Layered Operating SystemSem II rd year G5-G8

66 Layered Approach(cont)The layered approach suffers from two problems:The operation of a system be slowed down by the layered structure. Each layer adds a system call overhead.The second problem concerns difficulties in developing a layered design.UNIXUNIX – limited by hardware functionality, the original Unix operating system had limited structuring. The Unix OS consists of two separable partsSystems programsThe kernelConsists of everything below the system-call interface and above the physical hardwareProvides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one levelSem II rd year G5-G8

67 Virtual MachinesA 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 creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory.The resources of the physical computer are shared to create the virtual machines.CPU scheduling can create the appearance that users have their own processor.Spooling and a file system can provide virtual card readers and virtual line printers.A normal user time-sharing terminal serves as the virtual machine operator’s console.Sem II rd year G5-G8

68 Virtual Machines(cont)The heart of the system, known as the virtual machine monitor, runs on the bare hardware and does the multiprogramming, providing not one, but several virtual machines to the next layer up.However, unlike all other operating systems, these virtual machines are not extended machines, with files and other nice features.Instead, they are exact copies of the bare hardware, including kernel/user mode, I/O, interrupts, and everything else the real machine has.Because each virtual machine is identical to the true hardware, each one can run any operating system that will run directly on the bare hardware.Sem II rd year G5-G8

70 Strengths/weakness of Virtual MachinesThe virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines.This isolation, however, permits no direct sharing of resources.A virtual-machine system is a perfect vehicle for operating-systems research and development.System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation.The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine. (weakness)Sem II rd year G5-G8

71 Microkernel System StructureMicrokernel is a small OS core that provides the foundation for modular extensions.The main function of microkernel is to provide a communication facility between the client program and the various services that are also running in user space.At the bottom layer, running in kernel mode, is a program called the Microkernel.Its job is to allocate resources to virtual machines and then check attempts to use them to make sure no machine is trying to use somebody else's resources.Each user-level virtual machine can run its own operating system, except that each one is restricted to using only the resources it has asked for and been allocated.Sem II rd year G5-G8

72 . Microkernel System Structure (cont)The microkernel need only keep track of which virtual machine has been assigned which resource.The microkernel architecture assigns only a few essential functions to the kernel, including address space, inter-process communication and basic scheduling.The microkernel is designed to support execution of OS code which exists outside it.This feature permits new features and facilities to be added to the OS to suit specific operating environments.Benefits:easier to extend a microkerneleasier to port the operating system to new architecturesmore reliable (less code is running in kernel mode)more secureDetriments:Performance overhead of user space to kernel space communicationSem II rd year G5-G8

73 Solaris Modular ApproachV. Modules System StructureMost modern operating systems implement kernel modulesUses object-oriented approachEach core component is separateEach talks to the others over known interfacesEach is loadable as needed within the kernelOverall, similar to layers but with more flexibleSolaris Modular ApproachSem II rd year G5-G8

74 Practice ExercisesWhat are the three main purposes of an operating system?State the main advantage of multiprogramming?What are the main differences between operating systems for mainframe computers and personal computers?In a multiprogramming and time-sharing environment, several users share the system simultaneously. This situation can result in various security problems.a. What are two such problems?b. Can we ensure the same degree of security in a time-shared machine as we have in a dedicated machine? Explain your answer.What are the differences between a trap and an interrupt? What is the use of each function?Give two reasons why caches are useful. What problems do they solve? What problems do they cause? If a cache can be made as large as the device for which it is caching (forinstance, a cache as large as a disk), why not make it that large and eliminate the device?Sem II rd year G5-G8

75 States the functions of the OS in relation to resource management. Practice Exercises(Cont)What are the five major activities of an operating system in regard to process management?States the functions of the OS in relation to resource management.Describe the three major activities of an operating system in regard to memory managementWhat is the purpose of the command interpreter? Why is it usually separate from the kernel?What is the purpose of system calls? Using system calls, write a program in either C or C++ that reads data from one file and copies it to another file.Sem II rd year G5-G8

76 OPERATING SYSTEM AND ITS STRUCTURESEND OF CHAPTER ONEOPERATING SYSTEM AND ITS STRUCTURESSem II rd year G5-G8