This action might not be possible to undo. Are you sure you want to continue?
1 – Introduction
Course lectured by Prof. Gabriel Kuper Lab assist. Ilya Zaihrayeu http://www.dit.unitn.it/~ilya/os.htm
Operating System Operating System: a program that acts as an intermediary between a user of a computer and the computer hardware Q: What are the two main functions of an operating system? A:
Make user work with the hardware convenient Efficient operation of the computer system
Ilya Zaihrayeu Operating Systems Course
This I/O may involve a file or an I/O device. the operating system must provide some means to do I/O File-system manipulation: programs need to read and writes files. cont’d Q: What are the five basic services provided by an operating system? A: Program execution: the system must be able to load a program into memory and run it I/O operations: a running program may require I/O. They also need to create and delete files by name Ilya Zaihrayeu Operating Systems Course 3 . For efficiency and protection. users usually cannot control I/O devices directly.Operating System. Therefore.
For each type of error. Errors may occur in the CPU and memory hardware. or in a program. cont’d A [cont’d]: Communication: there are many circumstances in which one process needs to exchange information with another process. Communications may be implemented via share memory. the operating system should take the appropriate action to ensure correct and consistent computing Ilya Zaihrayeu Operating Systems Course 4 . in which packets of information are moved between processes by operating system Error detection: the operating system constantly needs to be aware of possible errors. or by the technique of message passing.Operating System. in I/O devices.
Operating System. cont’d A possible point from which it is convinient to view an operating system: a set of disassembled system components and their interconnections System components are: Process management Main-memory management File management I/O system management Secondary-storage management Networking Protection system Command-interpreter system Ilya Zaihrayeu Operating Systems Course 5 .
including CPU time. memory. A process needs certain resources. files.Process Management Q: What are the five major activities of an operating system in regard to process management? A process is a program in execution. and I/O devices. to accomplish its task A: Creation and deletion of both user and system processes Suspension and resumption of processes Provision of mechanisms for process synchronization Provision of mechanisms for process communication Provision of mechanisms for deadlock handling Ilya Zaihrayeu Operating Systems Course 6 .
It is a repository of quickly accessible data shared by the CPU and I/O devices.Main-memory Management Q: What are the three major activities of an operating system in regard to main-memory management? Memory is a large array of words or bytes. It loses its contents in the case of system failure A: Keep track of which parts of memory are currently being used and by whom Decide which processes to load when memory space becomes available Allocate and deallocate memory space as needed Ilya Zaihrayeu Operating Systems Course 7 . each with its own address. Main memory is a volatile storage device.
File Management Q: What are the five major activities of an operating system in regard to file management? A file is a collection of related information defined by its creator. files represent programs (both source and object forms) and data A: File creation and deletion Directory creation and deletion Support of primitives for manipulating files and directories Mapping files onto secondary storage File backup on stable (nonvolatile) storage media Ilya Zaihrayeu Operating Systems Course 8 . Commonly.
for both programs and data A: Free space management Storage allocation Disk scheduling Ilya Zaihrayeu Operating Systems Course 9 . Most modern computer systems use disks as the principle on-line storage medium.Secondary-storage Management Q: What are the three major activities of an operating system in regard to secondary-storage management? Since main memory (primary storage) is volatile and too small to accommodate all data and programs permanently. the computer system must provide secondary storage to back up main memory.
or even thousands. In the hierarchy that starts with a simple microprocessor (in watches. for example) at the bottom and moves to supercomputers at the top. of users simultaneously. Mainframes Q: List some differences between personal computer operating systems and mainframe operating systems Mainframe is a very large and expensive computer capable of supporting hundreds.Personal Computers vs. mainframes are just below supercomputers Ilya Zaihrayeu Operating Systems Course 10 .
on the other hand. allow timesharing and many users can log on at the same time. The parents and the children can work together simultaneously Ilya Zaihrayeu Operating Systems Course 11 . etc to keep everything in order. For example. Mainframes. The OS must be able to check process's owners and permission. the user can have as many processes as he wants but the work must be done one job at a time. There is no need for OS to handle with process scheduling and permission. No parallelism achieved Mainframes. If a parent process produces a child. in DOS. No timesharing. cont’d A: Personal computers only allow one user at a time.Personal Computers vs. Parallelism can be achieved through process switching. the parent is suspended until its child finishes its job.
With modularity. is the hardware. layers are selected such that each uses functions (operations) and services of only lower-level layers Ilya Zaihrayeu Operating Systems Course 12 . each built on top of lower layers. The bottom layer (layer 0).Layered System Design Q: What is the main advantage and disadvantage of the layered approach to system design? In the levered approach the operating system is divided into a number of layers (levels). the highest (layer N) is the user interface.
because the layers bellow it are already debugged Ilya Zaihrayeu Operating Systems Course 13 . because it uses only the basic hardware (which is assumed to be correct) to implement its functions. and so on. This simplifies debugging and system verification.Layered System Design. its correct functioning can be assumed while the second layer is worked on. The first layer can be debugged without any concern for the rest of the system. Once the first layer is debugged. we know that the error must be on that layer. The layers are selected such that each uses functions and services of only lower-level layers. cont’d A: Advantage: modularity. If an error is found during the debugging of a particular layer.
cont’d A [cont’d]: Disadvantage: system calls take longer since parameters and data may be modified and/or passed at each layer. Thus each layer adds overhead to the system call and the net result is a system call that takes longer then one does on a non-layered system Ilya Zaihrayeu Operating Systems Course 14 .Layered System Design. for a user program to execute an I/O operation. For instance. and finally to the hardware. which calls the memory management layer. through to the CPU scheduling layer. it executes a system call which is trapped to the I/O layer.
DMA and Multiprogramming Q: On early computers. there can be no true simultaneous execution of different programs. Computers that have DMA channels can transfer data to and from devices much more quickly than computers without a DMA channel can Multiprogramming is a rudimentary form of parallel processing in which several programs are run at the same time on a uniprocessor. What implications does this organization have for multiprogramming? Direct Memory Access (DMA) is a technique for transferring data from main memory to a device without passing it through the CPU. the operating system executes part of one program. To the user it appears that all programs are executing at the same time Ilya Zaihrayeu Operating Systems Course 15 . Since there is only one processor. every byte of data read or written was directly handled by the CPU (i. Instead.e. and so on. there was no DMA). then part of another.
the CPU is fully occupied doing I/O. If there is no DMA. No matter how much I/O a program does. cont’d A: The prime reason for multi-programming is to give the CPU something to do while waiting for I/O to complete. the CPU will be 100 percent busy Ilya Zaihrayeu Operating Systems Course 16 . so there is nothing to be gained (at least in terms of CPU utilisation) by multi-programming.DMA and Multiprogramming.
the kernel is responsible for memory management. process and task management. the command interpreter is called the shell Kernel is the central module of an operating system. and disk management Ilya Zaihrayeu Operating Systems Course 17 . It is the part of the operating system that loads first. and it remains in main memory. Because it stays in memory. it is important for the kernel to be as small as possible while still providing all the essential services required by other parts of the operating system and applications.The Shell and the Kernel Q: What is the purpose of the command interpreter? Why is it usually separate from the kernel? A command interpreter is the part of a computer operating system that understands and executes commands that are entered interactively by a human or from a program. Typically. In some operating systems.
The kernel's job is to allow multiple programs. multiple users in multi-user systems to access the hardware as if each program had its own computer Another advantage to separating the kernel from the command interpreter is that it allows different command interpreters to be run without kernel modification. the user can choose which shell he or she will use Ilya Zaihrayeu Operating Systems Course 18 .The Shell and the Kernel. cont’d A: The command interpreter is usually separate from the kernel because its purpose differs from that of the kernel. Since the kernel does not include the command interpreter.
Interrupt signals can cause a program to suspend itself temporarily to service the interrupt. or by a specific request from a user program that an operatingsystem service be performed Ilya Zaihrayeu Operating Systems Course 19 . Interrupts can be generated by devices. A software interrupt is also called a trap or an exception. to indicate that some event has occurred.Traps and Interrupts Q: What is the main difference between a trap and interrupt? An interrupt is a a signal informing a program that an event has occurred. These are called hardware interrupts Interrupt signals initiated by programs are called software interrupts. When a program receives an interrupt signal. such as a printer or keyboard. it takes a specified action (which can be to ignore the signal). Traps are usually caused either by an error (for example division by zero or invalid memory access).
cont’d A: A trap and an interrupt differ with respect to the sources that generate them. A trap is a softwaregenerated and may be caused either by an error or a user request while an interrupt is a hardwaregenerated change-of-flow within the system An interrupt handler is activated to deal with the cause of the interrupt. control is then returned to the interrupted context and instruction An interrupt can be used to signal the completion of an I/O to obviate the need for device polling while a trap can be used to call operating system routines or to catch arithmetic errors Ilya Zaihrayeu Operating Systems Course 20 .Traps and Interrupts.
chaos will occur. Clock is very important and should be allowed to change by only kernel Yes. can work since there will be no clock interrupt to allow OS to switch from one process to another No. If CPU allows user processes to disable all interrupts. Memory mapping should be reserved only for the kernel Ilya Zaihrayeu Operating Systems Course b) c) d) 21 . It is not critical enough Yes. Say one user process disables all interrupts and never re-enables it.Kernel Mode Q: Which of the following instructions should be allowed only in kernel mode? a) Disable all interrupts b) Read the time-of-day clock c) Set the time-of-day clock d) Change the memory map a) A: Yes. not even OS itself. No other processes.
Can it also be used in a single-computer system? If it can. In a network. the server. the client.Client-server Model Q: The client-server model is popular in distributed systems. allow one process to be the server and another to be the client Ilya Zaihrayeu Operating Systems Course 22 . which fulfills the request. makes a service request from another program. All that is required is a multiprogramming system. then how? Client/server describes the relationship between two computer programs in which one program. the client/server model provides a convenient way to interconnect programs that are distributed efficiently across different locations A: Yes.
“Operating System Concepts” Ilya Zaihrayeu Operating Systems Course 23 . Tanenbaum.References Andrew S. “Modern Operating Systems” Silberschatz Galvin.