Presentation is loading. Please wait.

Presentation is loading. Please wait.

OS/Kernel Structure Module 01.

Similar presentations


Presentation on theme: "OS/Kernel Structure Module 01."— Presentation transcript:

1 OS/Kernel Structure Module 01

2 MS-DOS Layer Structure

3 Unix is a monolithic system
UNIX – the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts. Systems programs The kernel Consists of everything below the system-call interface and above the physical hardware Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level.

4 UNIX System Structure

5 System Structure – Layered Approach
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. Why layering? explicit structure allows identification, relationship of complex system’s pieces modularization eases maintenance, develop, updating of system change of implementation of layer’s service transparent to rest of system e.g., change in gate procedure doesn’t affect rest of system layering considered harmful?

6 Layered Structure of the THE OS
A layered design was first used in THE operating system. Its six layers are as follows: layer 5: user programs layer 4: buffering for input and output layer 3: Process management layer 2: memory management layer 1: CPU scheduling layer 0: hardware

7 OS/2 Layer Structure

8 Microkernels Small operating system core
Contains only essential operating systems functions Many services traditionally included in the operating system are now external subsystems device drivers file systems virtual memory manager windowing system security services

9

10 Benefits of a Microkernel Organization
Uniform interface on request made by a process All services are provided by means of message passing, not system calls. Examples of opening a file Creating threads Extensibility Allows the addition of new services Flexibility New features added Existing features can be subtracted

11 Benefits of a Microkernel Organization
Portability Changes needed to port the system to a new processor is changed in the microkernel - not in the other services Reliability Modular design Small microkernel can be rigorously tested

12 Benefits of Microkernel Organization
Distributed system support Message are sent without knowing what the target machine is Object-oriented operating system Components are objects with clearly defined interfaces that can be interconnected to form software

13 Microkernel Design Low-level memory management
Microkernel must include functions that depend on the HW and functions needed to support the servers and applications operating in user mode. Low-level memory management mapping each virtual page to a physical page frame. Other memory functions like swapping, protection, paging, etc is done by VM service. Inter-process communication Using ports. A port is a mailbox associated with one receiver and multiple senders. I/O and interrupt management Interrupts are transformed into messages.

14 KLM Examples of ukernels are Mach and Chorus
Are the basis for KLM (Kernel Loadable Modules) Linux modules are located in /lib/modules and they have had the extension ".ko" since version 2.6. Sound Device Drivers Network support (Apple Talk, Novel, etc) Language support VM (the virtualization layer) etc

15 Virtual Machines A virtual machine provides multiprogramming only by providing exact virtual copies of the bare 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. Virtual Machine: A machine implemented in software, not actual hardware. Also known as a machine emulator, not as OS simulator. Each virtual machine can run any OS on top of it You can run different OSs, each best suited for some task, on the same physical machine Similar to Java approach. JVM is an application VM. Virtual PC for Windows allows you to create separate “virtual machines” on top of your Windows desktop, where you can install virtually any PC-based operating system including OS/2, Linux, Solaris, NetWare or other versions of Windows. Each virtual machine emulates a complete hardware system – from processor to network card – in a self-contained, isolated software environment, enabling the simultaneous operation of otherwise incompatible systems.

16 Virtual Machines (Cont.)
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. Instruction set emulation Benefits of VM OS A big plus for SW development – can run and test SW simultaneously on multiple OS on a single machine, without rebooting. Testing can take place with different system configuration, like memory, disk space, etc. IT professionals can safely migrate and deploy new operating systems – while continuing to run and support older or custom legacy applications. Internet VPS Cloud Computing – Amazon Elastic CC (or EC2) Testing networked machines with multiple NEs (routers, FWs, etc) Testing and parallel and distributed programming for cluster nodes Sandboxing – play and test in a protected environment w/o risking damage to other kernels running. Server consolidation: virtualization allowed a single server to replace multiple underutilized dedicated servers. Any drawbacks?

17 System Models Virtual Machine
Similar to standalone Hyber-V whereby a thin layer is installed first Virtual Machine (Classical Type originated by IBM VM370 in 1972) Non-virtual Machine Virtualization layer or Hypervisor or VMM Possible that it can span over multiple CPUs (even in a distributed fashion). Referred as “Platform Virtualization” VmWare (from Vmware Inc.), Virtual PC (Connectix, now Mircorsoft, Integrated within Windows 7 to run all Windows XP apps) KVM (preferred choice for Red Hat and Ubuntu) Xen (freeware) Virtualbox from Sun Inc. A complete list is available at

18 VMware architecture – Common Type (e.g. vmware)

19 Modern Virtualization
Intel VT and AMD-V processors have hardware assisted virtualization to yield better performance Full vs. Partial Virtualization Much of the underlying hardware is emulated, but not all Paravirtualization Guest OS has special calls to VM, called hybervisor calls to speed access i.e. it provides an interface to VM Faster as the virtualization layer becomes smaller

20 Windows Hyper-V (2008 Server)

21 Hyper-V Architecture (1/2)
 A partition is a logical unit of isolation in which an OS executes. The virtualization stack runs in the parent partition and has direct access to the hardware devices. The parent partition then creates the child partitions which host the guest OSs. A parent partition creates child partitions using the hypercall API. A virtualized partition does not have access to the physical processor, nor does it handle its real interrupts. Instead, it has a virtual view of the processor and runs in Guest Virtual Address.

22 Hyper-V Architecture (2/2)
The hypervisor handles the interrupts to the processor, and redirects them to the respective partition using a logical Synthetic Interrupt Controller (SynIC). Hyper-V can hardware accelerate the address translation between various Guest Virtual Address-spaces by using an IOMMU (I/O Memory Management Unit) which operates independent of the memory management hardware used by the CPU. Parent partitions run a Virtualization Service Provider (VSP), which connects to the VMBus and handles device access requests from child partitions. Child partition virtual devices internally run a Virtualization Service Client (VSC), which redirect the request to VSPs in the parent partition via the VMBus.

23 Microsoft Windows Single-user multitasking
From Windows 2000 on, Windows development developed to exploit modern 32-bit and 64-bit microprocessors Designed for single users who run multiple programs Main drivers are: Increased memory and speed of microprocessors Support for virtual memory Windows was driven by a need to exploit the processing capabilities of today’s 32-bit and 64-bit microprocessors, which rival mainframes of just a few years ago in speed, hardware sophistication, and memory capacity. One of the most significant features of these new operating systems is that, although they are still intended for support of a single interactive user, they are multitasking operating systems. Two main developments have triggered the need for multitasking on personal computers, workstations, and servers. The increased speed and memory capacity of microprocessors, The support for virtual memory. 23

24 Windows Architecture Figure 2.13 illustrates the overall structure of Windows 2000; later releases of Windows, including Vista, have essentially the same structure at this level of detail. Its modular structure gives Windows considerable flexibility. Windows separates application-oriented software from the core OS software. The latter, which includes the Executive, the Kernel, device drivers, and the hardware abstraction layer, runs in kernel mode. Kernel mode software has access to system data and to the hardware. The remaining software, running in user mode, has limited access to system data. Windows has a highly modular architecture. Each system function is managed by just one component of the OS. The rest of the OS and all applications access that function through the responsible component using standard interfaces. Key system data can only be accessed through the appropriate function. In principle, any module can be removed, upgraded, or replaced without rewriting the entire system or its standard application program interface (APIs). 24

25 Client/Server Model Windows OS, protected subsystem, and applications all use a client/server model Common in distributed systems, but can be used internal to a single system Processes communicate via RPC The Windows operating system services, the protected subsystems, and the applications are structured using the client/server computing model, which is a common model for distributed computing The native NT API is a set of kernel-based services which provide the core abstractions used by the system, such as processes, threads, virtual memory, I/O, and communication. Windows provides a far richer set of services by using the client/server model to implement functionality in user-mode processes. Both the environment subsystems and the Windows user-mode services are implemented as processes that communicate with clients via RPC. Each server process waits for a request from a client for one of its services (for example, memory services, process creation services, or networking services). A client, which can be an application program or another server program, requests a service by sending a message. The message is routed through the Executive to the appropriate server. The server performs the requested operation and returns the results or status information by means of another message, which is routed through the Executive back to the client. 25

26 Windows Objects Windows draws heavily on the concepts of object-oriented design. Key Object Oriented concepts used by Windows are: Encapsulation Object class and instance Windows draws heavily on the concepts of object-oriented design. This approach facilitates the sharing of resources and data among processes and the protection of resources from unauthorized access. Among the key object-oriented concepts used by Windows are the following: Encapsulation: An object consists of one or more items of data, called attributes, and one or more procedures that may be performed on those data, called services. The only way to access the data in an object is by invoking one of the object’s services. Thus, the data in the object can easily be protected from unauthorized use and from incorrect use (e.g., trying to execute a nonexecutable piece of data). Object class and instance: An object class is a template that lists the attributes and services of an object and defines certain object characteristics. The OS can create specific instances of an object class as needed. e.g., there is a single process object class and one process object for every currently active process. This approach simplifies object creation and management. Inheritance: Although the implementation is hand coded, the Executive uses inheritance to extend object classes by adding new features. Every Executive class is based on a base class which specifies virtual methods that support creating, naming, securing, and deleting objects. Dispatcher objects are Executive objects that inherit the properties of an event object, so they can use common synchronization methods. Other specific object types, such as the device class, allow classes for specific devices to inherit from the base class, and add additional data and methods. Polymorphism: Internally, Windows uses a common set of API functions to manipulate objects of any type; this is a feature of polymorphism. However, Windows is not completely polymorphic because there are many APIs that are specific to specific object types. 26

27 Traditional UNIX Kernel
User programs can invoke OS services either directly or through library programs. The system call interface is the boundary with the user and allows higher-level software to gain access to specific kernel functions. At the other end, the OS contains primitive routines that interact directly with the hardware. Between these two interfaces, the system is divided into two main parts, one concerned with process control and the other concerned with file management and I/O. The process control subsystem is responsible for memory management, the scheduling and dispatching of processes, and the synchronization and interprocess communication of processes. The file system exchanges data between memory and external devices either as a stream of characters or in blocks. To achieve this, a variety of device drivers are used. For block-oriented transfers, a disk cache approach is used: a system buffer in main memory is interposed between the user address space and the external device. 27

28 System V Release 4 (SVR4) Almost a complete rewrite of the System V kernel and produced a clean, if complex, implementation. New features in the release include real-time processing support, process scheduling classes, dynamically allocated data structures, virtual memory management, virtual file system, and a preemptive kernel. It incorporates most of the important features ever developed on any UNIX system and does so in an integrated, commercially viable fashion. 28

29 Linux Modular Monolithic Kernel
Although monolithic, the kernel is structures as a collection of modules Loadable modules An object file which can be linked and unlinked at run time Characteristics: Dynamic Linking Stackable modules For checking dependencies when unloading Although Linux does not use a microkernel approach, it achieves many of the potential advantages of this approach by means of its particular modular architecture. Linux is structured as a collection of modules, a number of which can be automatically loaded and unloaded on demand. These relatively independent blocks are referred to as loadable modules. In essence, a module is an object file whose code can be linked to and unlinked from the kernel at runtime. The Linux loadable modules have two important characteristics: Dynamic linking: A kernel module can be loaded and linked into the kernel while the kernel is already in memory and executing. A module can also be unlinked and removed from memory at any time. Saves kernel memory. Stackable modules: The modules are arranged in a hierarchy. Individual modules serve as libraries when they are referenced by client modules higher up in the hierarchy, and as clients when they reference modules further down. 29

30 Example of loading two modules: FAT & VFAT
VFAT is a client of FAT Figure 2.17 is an example that illustrates the structures used by Linux to manage modules. It shows that the VFAT module was loaded after the FAT module and that the VFAT module is dependent on the FAT module. The figure shows the list of kernel modules after only two modules have been loaded: FAT and VFAT. Each module is defined by two tables, The module table and the symbol table. The module table includes the following elements: *next: Pointer to the following module. All modules are organized into a linked list. The list begins with a pseudomodule (not shown in Figure 2.17). *name: Pointer to module name. size:Module size in memory pages. usecount:Module usage counter. The counter is incremented when an operation involving the module’s functions is started and decremented when the operation terminates. flags:Module flags. nsyms: Number of exported symbols. ndeps: Number of referenced modules *syms: Pointer to this module’s symbol table. *deps: Pointer to list of modules the are referenced by this module. *refs: Pointer to list of modules that use this module. The symbol table defines those symbols controlled by this module that are used elsewhere: global variables and function names. 30

31 *name: Pointer to module name. size:Module size in memory pages.
*next: Pointer to the following module. All modules are organized into a single linked list. *name: Pointer to module name. size:Module size in memory pages. usecount:Module usage counter. The counter is incremented when an operation involving the module’s functions is started and decremented when the operation terminates. flags:Module flags. nsyms: Number of exported symbols. ndeps: Number of referenced modules *syms: Pointer to this module’s symbol table. *deps: Pointer to list of modules the are referenced by this module. *refs: Pointer to list of modules that use this module.

32

33

34 Linux Kernel Components
This figure shows the main components of the Linux kernel as implemented on an IA-64 architecture (e.g., Intel Itanium). It shows several processes running on top of the kernel. Each box indicates a separate process, while each squiggly line with an arrowhead represents a thread of execution. The kernel itself consists of an interacting collection of components, with arrows indicating the main interactions. The underlying hardware is also depicted as a set of components with arrows indicating which kernel components use or control which hardware components. All of the kernel components, of course, execute on the processor but, for simplicity, these relationships are not shown. 34


Download ppt "OS/Kernel Structure Module 01."

Similar presentations


Ads by Google