Vous êtes sur la page 1sur 9

Assignment 1

Part 1:
1. Define the concepts interrupt and trap, and explain the purpose of an interrupt vector. A trap is a type of pause in the program execution that is caused by an invalid software routine. Traps are considered as exceptions. They are normally caused by a programmer who wishes to transfer the control of the processor to another subroutine. Interrupts are also pauses in the execution but they are caused by an external hardware event. The most common source of interrupts is an external I/O. I/O devices generate interrupts in the code to announce their presence to the system. When an interrupt is called, an interrupt handler is generated. The interrupt vector is the memory address of that interrupt handler. 2. How does a computer system with von Neumann architecture execute an instruction? The Von Neumann architecture offers a relatively simpler computer design. In such systems, reading and writing of data to and from the main memory is done on one data bus and fetching instructions for executions on another. Memory addresses are also different. Data and program are in the same memory. The processor consists of an ALU that can implement basic functions and operations and a temporary storage that can store not more than a few words of data. 3. What role do device controllers and device drivers play in a computer system? A device controller is the main hardware component of any device that connects to a computer system. It provides an interface between that device and the operating system of the computer. The device controller has in-built registers and buffers to store and execute simple instructions that it is programmed to do.

A device driver is software that runs the device. The device driver further acts as an interface between the device controller and the operating system of the computer. The device driver is installed on the computer that the device is to be connected to. Through the driver, both the user and the system itself can communicate with the device. 4. Why do clustered systems provide what is considered high-availability service? In a clustered system, several computer systems are interconnected in a way that they become interoperable. They are known for their high ability service because the connection of computers gives an overall enhancement in the processing power. The computers can be seen as one and their combined power can be used to perform a single task. The power may also be distributed evenly among more users. In high availability clusters, the extra nodes provide the hardware service when a specific hardware component fails, thus eliminating the possibility of having a single point of failure. 5. Describe an operating systems two modes of operation. Modern CPUs support at least two modes of operation: protected mode and supervisor mode. The protected mode is very important as it is the mode in which all applications generally function. The protected mode protects the hardware from direct access through applications. It requires the applications to communicate with the kernel which in turn communicates with the hardware. In the supervisor mode, the operating systems kernel is used for low level operations that need direct access to hardware. This form of access is necessary for the operating system to interact with different hardware components. 6. Define cache, and explain cache coherency. A cache is a form of memory which temporarily and automatically stores data which a user references. Data calls that are frequently or recently made are stored in the cache. This way, if a

user references the same data again, it can be accessed much faster. Coherency between caches is the consistency of data that is stored in the two concerned caches. In multi-processor systems, each core may have its own cache. The data in those caches must be consistent. In coherent caches, if the data is modified in one cache, the other cache copies the same data, thus ensuring consistency. 7. Describe why direct memory access (DMA) is considered an efficient mechanism for performing I/O. In traditional computers, whenever the systems memory has to be accessed, it is done through the CPU. Modern computers introduced the concept of direct memory access. As the name suggests, with DMA, I/O devices may directly access the systems memory, without going through the CPU. DMA is considered efficient as it allows the hardware to access memory even if the CPU is busy or already running a process. This way, the time taken for I/O devices to access the systems memory is reduced. I/O devices dont have to wait for the CPU to get free to access system memory. 8. Describe why multicore processing is more efficient than placing each processor on its own chip. A multicore processor has two or more processors working on the same chip as opposed to having one processor on one chip. The main advantage of multicore processors is that although the execution to be carried out is simple, each core can perform its own function independently of the other processor. This way, multiple threads can be run at the same time. This would reduce the overall time taken for program execution. Processor usage may become more efficient. Software developers, however, must ensure the proper programming of the code to run on multiprocessor systems. 9. Describe the relationship between an API, the system-call interface, and the operating system. Application Programming Interface is a software interface between external software components

i.e. software that is not part of the operating systems. It is basically a library that includes functions, structures and classes that allow for easy communication between different software. External hardware cannot directly modify the OS. It interacts with the OS through system calls. The system calls in turn interact with the OS. The OS is the last layer between the hardware and applications/users. OS determines how the processor and memory are to be handled by external hardware or I/O. Applications interact with OS through APIs. The OS then modifies or uses the hardware as required. 10. Describe some requirements and goals to consider when designing an operating system. An OS should consider as the utmost priority how the CPU is used and how system memory is accessed. As different devices such as hardware, software and I/O devices need to use the CPU or to access or modify the main memory, the OS must handle all these requests efficiently. There must be a proper OS algorithm that determines how these requests are handled. The OS must efficiently manage memory. It is also a resource allocator. It must allocate computing and memory resources to different applications and hardware efficiently. 11. Explain why a modular kernel may be the best of the current operating system design techniques. Normal kernels load everything when a user boots the computer. A modular kernel is divided into modules. The kernel that is needed is called when it is needed. Thus a major advantage is that the time taken to start the computer is decreased as only selective kernels are loaded at boot time. Similarly, while running applications or hardware routines, only the kernels that are required are called and run. As only smaller modules are used, the size of each kernel becomes small, thus making it easier to load. New modules can also be easily generated. 12. Distinguish between virtualization and simulation. Virtualization is faking an action that a real hardware or software component would provide. In

virtual environments, the concerned tools pretend to be real tools, thus fooling the operating system or other hardware involved. The system cannot differentiate and is thus unaware of what is happening. Simulation creates an environment where the user can practice or create something in a rather controlled software environment. Simulations are not real; neither do they pretend to be. They are used where controlled practice may be required such as in preparing astronauts for flying shuttles. Part 2: Design Considerations 1. Draw a typical computer organization figure that includes the main components of

von Neumann architecture. Identify each component, and explain its function and interaction relative to other components. (15 marks)
The Von Neumann architecture for a typical computer organization has the following basic components:

Memory: Storage of info Processing Unit: Computation/Processing of Info Input: Resources for getting info into the computer Output: Resources for getting info out of the computer Control Unit: Keeps check on tasks being done correctly and at proper time.

Memory and processing unit communicate by means of two registers:

Memory Address Register (MAR) Memory Data Register (MDR)

ALU's, registers, memory, etc., are linked together into a data-path. Gates control the flow of bits around data-path and the instructions controlling the flow of bits are called microinstructions.

The memory has two key operations fetch(address) and store(address, value). With this type of memory CPU can access any value of the array at any time and these are called random-access memory. Non-volatile or read-only memory is also present.

The control unit manages the Processing Unit and is implemented as FSM which directs all activities. It has clock based step-by-step processing and FSM is controlled by clock signal, IR and reset signal.

I/O ports are interface points for exchanging data between processor and I/O interface. Two ways of mapping I/O ports are memory-mapped I/O and isolated I/O.

2. Define system call, and list the main types of system calls. Elaborate on how a system

call interacts with a standard C library and hardware under a dual-mode operating system environment. (10 marks)
System Call: It is a request made to the kernel by a program which may include creating and executing new processes, hardware related services and communicating with vital kernel services. System calls provide a crucial interface between a process and the operating system. They are also known as kernel calls.

A library or API is provided by the systems that interact between operating system and normal programs. On Windows NT, ntdll.dll library has API, which is a part of native API, and Unix type systems have API, which is an implemented part of C library like glibc. These provide system calls with wrapper functions which expose an ordinary function calling convention for using the system call and make it modular. The wrappers main function is to place all the arguments in the appropriate processor registers which are to be passed to the system. Therefore the library, between the OS and the application, increases portability. A switch to kernel mode is not caused by the call to the library function and is normally a subroutine call. Control is transferred to kernel by the actual system call as in Unix-like systems, fork and execve system calls are invoked by fork and execve C library functions. Making the system call directly in the apps code is not feasible. A trap should be acquired and process should be terminated or stopped hastily if the user process tries to execute a privileged instruction but a chunk of the operating system code must be allowed to execute the privileged instructions. Two different modes of the operation, which are user mode and monitor mode, are required for the CPU to be able to differentiate between the user process and an operating system code. There is a bit called the mode bit which is added to hardware indication of the present mode i.e. monitor mode (0) or user mode (1). The OS performs those operations which the user could not execute due to the concept of privileged instructions. This done by the user by requesting OS some task and the kernel then makes a system call to perform the operation. CPU mode is switched to the system mode before the appropriate kernel code begins to execute operation whenever a system call is made or a trap, an interrupt, or signal is generated. Afterwards the CPU mode is switched back to the user mode

3. Describe the overall structure of virtual machines, and compare VMware and JVM. (15 marks) A virtual machine (VM) executes programs like a physical machine but it is actually a software implementation of a machine. There are two main classifications of VMs on the basis of their use and amount of correspondence to any real machine: A process VM is designed to run a single program i.e. it supports a single process. Such VMs are built with the purpose of providing portability and flexibility of a program. An important characteristic of a VM is that the software running inside cannot break out of its virtual environment. A system virtual machine supports the execution of a complete OS with a complete system platform. An imitation of an existing architecture and built with either the purpose of providing a platform to run programs where the real hardware is not available for use or of having numerous cases of virtual machines lead to more proficient use of computing resources, or both. VMware gives a seamless way to access all of the virtual machines you need no matter what there location is provided they are running. VMware virtualizes the hardware of the machine and the OS running inside a VMware container has different levels of alertness of running within a virtualized container. The OS does not know that it is running within a virtual container and is not modified at all but some specialized drivers are usually installed preventing performance issues. There are VM's that require the OS inside the container to make specific calls to the container in place of the regular hardware calls.

A JVM is a program which executes programs which have Java byte-code instructions. JVMs can be implemented to run on an existing operating system or directly on hardware. Java byte-code can be executed as a JVM provides a run-time environment with functions such as root-cause debugging info for every software error. A JVM is distributed along with Java Class Library which implements the Java API. JVMs are for many hardware and software platforms and same byte-code is used for all JVMs on all platforms and it is a crucial component of the Java platform.

Vous aimerez peut-être aussi