Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that.

Similar presentations


Presentation on theme: "Operating Systems The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that."— Presentation transcript:

1 Operating Systems The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that occurs in the system. The kernel is the first part of the operating system to load into the main memory (DRAM) during booting, and it remains in the memory for the entire duration of the computer session. The kernel is usually loaded into a protected area of memory, which prevents it from being overwritten by other programs. The kernel performs its tasks (e.g. executing processes and handling interrupts) in kernel space, whereas everything a user normally does is done in user space. the processor usually provides two modes of execution to separate normal user modes from the special supervisor privileges e.g. when a process executes a system call, the execution mode of the process changes from user mode to kernel mode. When a computer crashes, it actually means the kernel has crashed.

2 The kernel provides basic services for all other parts of the operating system, typically including memory management, process management, file management and I/O (input/output) management (i.e., accessing the peripheral devices). A typical kernel contains: Memory management:Allocates the system's address spaces among all users of the kernel's services. Timers: Kernel timers. System Calls: System calls interface. Interrupts and Exceptions: Interrupts and exceptions handling. Processes: Process management. Scheduling: Process scheduling. I/O: Low levelThe kernel should not be confused with the BIOS(Basic Input/Output System) which is an independent program stored in a chip on the motherboard that is used during the booting (i.e., startup) process for such tasks as initializing the hardware and loading the kernel into memory (RAM). Whereas the BIOS always remains in the computer and is specific to its particular hardware the kernel is different for every operating system or version.

3 Kernel Analogy to Chef Cooking a Dish Ingredients = computer applications Kitchen appliances = computer resources Dish = operating system –decides which ingredients and appliances are needed – i.e. the recipe Chef = kernel –chef decides when the ingredients are put in the appliances – the cook People attending dinner = users Without a recipe, a cook cannot prepare a dinner; A recipe without a cook cannot magically prepare itself.

4 Kernels can be classified into three broad categories: monolithic kernels microkernels Hybrid kernels Monolithic kernels, which have traditionally been used by Unix and Linux, contain all the operating system core functions and the device drivers.

5 A microkernel usually provides only minimal services, such as defining memory address spaces, interprocess communication (IPC) and process management. All other functions, such as hardware management, are implemented as processes running independently of the kernel. Hybrid kernels are similar to microkernels, except that they include additional code in kernel space so that such code can run more swiftly than it would were it in user space. These kernels represent a compromise.

6 System Calls Applications and modules in user space need to use system calls to communicate. –A system call analogy would be like having to use a phone via a switchboard to communicate with the person on the next desk. In a monolithic kernel every part of the kernel is located in the same address space – hence no system calls required.

7 Monolithic vs Microkernel Analogy Monolithic Kernel A single piece of beef Microkernel Chop the above piece of beef into chunks. Put each chunk in a plastic bag (isolation) Tie each bag together using pieces of string (IPC) The total weight for the microkernel analogy will be the weight of the beef plus the weight of bags and string. So, although the microkernel appears simple at a local level, it is much more complex at a global level.

8 The Monolithic Versus Micro Controversy With a monolithic kernel an error in the kernel can cause the entire system to crash. With a microkernel, if a kernel process crashes, it is still possible to prevent a crash of the system as a whole by merely restarting the service that caused the error. However, operating systems with monolithic kernels such as Linux have become extremely stable and can run for years without crashing. Another disadvantage cited for monolithic kernels is that they are not portable; that is, they must be rewritten for each new architecture that the operating system is to be ported to. However, in practice, this has not appeared to be a major disadvantage, and it has not stopped Linux from being ported to numerous processors. Monolithic kernels also appear to have the disadvantage that their source code can become extremely large.

9 However, the advocates of monolithic kernels claim that in spite of their size such kernels are easier to design correctly The size of the compiled kernel is only a tiny fraction of that of the source code. Contributing to the small size of the Linux kernel is its ability to dynamically load modules at runtime. Linux kernel can be made extremely small not only because of its ability to dynamically load modules but also because of its ease of customisation–e.g. embedded linux. Although microkernels are very small by themselves, in combination with all their required auxiliary code they are, in fact, often larger than monolithic kernels. There are extremely few widely used operating systems today that utilise microkernels--mainly just AIX and QNX

10 Shells The shell is the outermost part of the operating system. It is the part that interacts with the user. In modern operating systems most users interact with the operating system through a Graphical User Interface(GUI) The basic unit of software that the operating system deals with in scheduling the work done by the processor is either a processor a thread, depending on the operating system. A process is a program which is running i.e. the operating system has assigned the process memory it can use, a stack, priority, status etc. There are also numerous processes that run without giving you direct evidence that they ever exist. For example, Windows XP and UNIX can have dozens of background processes running to handle the network, memory management, disk management, etc. The operating system allows the application to begin running, suspending the execution only long enough to deal with interrupts and user input. Interrupts are special signals sent by hardware or software to the CPU. Some interrupts are masked--that is, the operating system will ignore the interrupts from some sources so that a particular job can be finished as quickly as possible.

11 Some interrupts are so important that they can't be ignored. These non-maskable interrupts(NMIs) must be dealt with immediately, regardless of the other tasks at hand. Multi-tasking allows several processes to be active at one time by switching between them, using timer interrupts. All of the information needed to keep track of a process when switching is kept in a data package called a process control block. The process control block(PCB) typically contains:..An ID number that identifies the process..Pointers to the locations in the program and its data where processing last occurred..Register contents..States of various flags and switches..Pointers to the upper and lower bounds of the memory required for the process..A list of files opened by the process..The priority of the process..The status of all I/O devices needed bythe process

12 Processes that are running often require an input from the user and whilst waiting is stopped –this state is known as blocked or suspended. Problems can occur if the user tries to have too many processes functioning at the same time. The operating system itself requires some CPU cycles to perform the saving and swapping of all the registers, queues and stacks of the application processes. When too many processes are active the vast majority of its available CPU cycles are used to swap between processes rather than run processes –thrashing. One way that operating-system designers reduce the chance of thrashing is by reducing the need for new processes to perform various tasks. Some operating systems allow for a "process- lite," called a thread, that can deal with all the CPU-intensive work of a normal process, but generally does not deal with the various types of I/O and does not establish structures requiring the extensive process control block of a regular process.


Download ppt "Operating Systems The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that."

Similar presentations


Ads by Google