Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / DEPARTMENT OF Comp

DEPARTMENT OF Comp

Computer Science

DEPARTMENT OF Comp.Science ENGINEERING

Course Title: Operating System

Course Code: CS22

Q 01:

  1. Hard real time system (with one short example).
  2. Soft real time system (With one short example).
  3. Draw the Block diagram of Multiprocessor system.
  4. Define Swapping with the help of diagram.
  5. Explain the term Dual-mode operation.

Answer:

(a):

Hard real time system:

  • Hard real time system guarantees that a job will be completed within a specified period of time.
  • This system ensures that all delays on processing, input and output are bounded.
  • The system cannot wait indefinitely so the hard time system is usually very limited.

 

  • Example:    Air traffic control systems

 

(b):

Soft real time system:

  • Soft real time system does not guarantee that a job will be completed within a specified time period.
  • It tries its best to finish the job as soon as possible.
  • If a critical real time job enters the system, the operating system may assign the highest priority to that task and execute it continuously until its complete.

 

  • Example: Mobile communication.

(c):

Draw the Block diagram of Multiprocessor system.

 

CPU 1

CPU 1

I/O

Processors

I/O

Unites

I/O

Processors

 

I/O

Unites

 

Main Memory

 

 
   

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(d):

Define Swapping with the help of diagram:

  • Swapping is a memory management scheme in which any process can be temporarily swapped from main memory to secondary memory so that the main memory can be made available for other processes.
  • It is used to improve main memory utilization. In secondary memory, the place where the swapped-out process is stored is called swap space.

 

Main Memory

Secondary Memory

Process P1

Process P2

Process P1

Process P3

Process P3

Process P1

Process P3

Process P4

Process Pn

·

·

  •  

P1 goes for I/O wait

Swap Out

Swap In

Swap Out

Swap In

P1 Comes back after I/O

 
   

 

 

 

 

(e):

Explain the term Dual-mode operation:

  • Dual-mode operation forms the basis for I/O protection, memory protection and CPU protection.
  • In dual-mode operation, there are two separate modes: monitor mode (also called 'system mode' and 'kernel mode') and user mode. In monitor mode, the CPU can use all instructions and access all areas of memory.
  • In user mode, the CPU is restricted to unprivileged instructions and a specified area of memory. User code should always be executed in user mode and the OS design ensures that it is.
  • When responding to system calls, other traps/exceptions, and interrupts, OS code is run. The CPU automatically switches to monitor mode whenever an interrupt or trap occurs. So, the OS code is run in monitor mode.

---------------------------------------------------------------------------------------------------------------------------

 

 

 

Q 02:                                                                                     (Each containing 2*3=6)

  1. Define the concept of Multiprogramming and Time-sharing system.
  2. Write Down at least three advantages of Time-sharing system.
  3. Explain the block diagram of Multiple Buses that are in use of I/O Hardware System.

Answer:

 

Ans: (a):

 

Multiprogramming:

 

  1. Multiprogramming is a technique that allows more than one program to be ready for execution (Process) and provides the ability to switch from one process to another, even if the former is not completed.
    • Of course, sometimes in the future we will have to switch back to the first process and resume (not restart) its computation.

 

  1. This technique works for both (like some personal computers) and multiprocessor (such as large main frame) computes.
  2. Multiprogramming is mainly accomplished by the operating system. The hardware provides some specific circuitry that may be used by the operating system in the course of facilitating multiprogramming.

 

Time-Sharing:

 

  1. Time sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time.
  2. Time-sharing or multitasking is a logical extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is termed as time­ sharing.
  3. The main difference between Multiprogrammed Batch Systems and Time-Sharing Systems is that in case of Multiprogrammed batch systems, objective is to maximize processor use, whereas in Time-Sharing Systems objective is to minimize response time.

 

Ans (b):

 

advantages of Time-sharing system:

  1. Provides the advantage of quick response.
  2. Avoids duplication of software.
  3. Reduces CPU idle time.

 

Ans (c):

block diagram of Multiple Buses:

  1. I/O devices can be roughly categorized as storage, communications, user-interface, and other
  2. Devices communicate with the computer via signals sent over wires or through the air.
  3. Devices connect with the computer via ports, e.g. a serial or parallel port.
  4. A common set of wires connecting multiple devices is termed a bus.
      • Buses include rigid protocols for the types of messages that can be sent across the bus and the procedures for resolving contention issues.

 

Figure 13.1 below illustrates three of the four bus types commonly found in a modern PC

 

  1. The PCI bus connects high-speed high-bandwidth devices to the memory subsystem ( and the CPU. )

 

  1. The expansion bus connects slower low-bandwidth devices, which typically deliver data one character at a time ( with buffering. )

 

  1. The SCSI bus connects a number of SCSI devices to a common SCSI controller.

 

  1. A daisy-chain bus, ( not shown) is when a string of devices is connected to each other like beads on a chain, and only one of the devices is directly connected to the host.

 

 

 

 

 

Q 03:                                                                                       (Each containing 3*3=9)

  1. Explain the difference between kernel and a shell.
  2. What are the ReadFile() parameters for the Standard API system call.
  3. Explain the Unix System Structure with the help of diagram.                                                                       

Answer:

Ans: (a):

 

 

The main difference between the kernel and the shell is that the kernel is the main part of the operating system that controls all the functions of the system while the shell is the interface that allows users to interact with the kernel.

 

KERNEL

SHELL

A computer program which acts as the core of the computer operating system and has the control over everything in the system.

A computer program which works as the interface to access the services provided by the operating system

Core of the system that control all the tasks of the system.

Interface between the kernel and the user

Does not have types

Has types such as Bourne shell, C shell, Korn shell, Bourne again shell, etc

 

KERNEL:

 

  • Kernel is “the Linux” itself. It’s a bunch of code that deals with networking, managing memory, talking to hardware devices such as disks, graphics cards, mouse, and so on.
  • It also knows how the contents of a disk is organized in files, and how to open files and read/write data into them. However, from user’s perspective, kernel is silent and invisible.
  • It just sits there and does nothing useful by itself. Its sole purpose is to provide the “magic” where programs can run and interact with each other and the hardware. The Linux kernel was initially written by Linus Torvalds.

 

SHELL:

 

  • A shell, on the other hand, is a program that you use to interact with a computer by typing commands. Shell reads your commands and executes them one after another.
  • For example, if you type “cp file1 file2”, shell understands that you want to copy a file. On your behalf, it then calls one or more kernel functions to create file2, open file1 for reading, read chunks of data from it, write chunks of data to file2, and finally to close both files.
  • Similarly, ff you type “rm file3”, shell will call one or more kernel functions to do that, and so on. If something goes wrong (file not found etc.), shell will print the error

 

Ans: (b):

 

An API is a generic term defining the interface developers have to use when writing code using libraries and a programming language. Kernels have no APIs as they are not libraries. They do have an ABI, which, beyond other things,

 

  1. The first volume of the Unix manual pages contains the shell commands.
     
  2. The second one contains the system call wrappers like write and open. They form the interface to the kernel.
     
  3. The third one contains the standard library (including the Unix standard API) functions (excluding system calls) like fopen and printf. These are not wrappers to specific system calls but just code using system calls when required.

 

API – System Call Implementation n The interface to the services provided by the OS has two parts:

 

1. Higher language interface – a part of a system library

  • Executes in user mode
  • Implemented to accept a standard procedure call
  • Traps to the Part 2

 

2. Kernel part:

  • Executes in system mode
  • Implements the system service
  • May cause blocking the caller (forcing it to wait)
  • After completion returns back to user (report the success or failure of the call)

 

Ans: (c):

 

The Unix operating system is a set of programs that act as a link between the computer and the user.

 

The computer programs that allocate the system resources and coordinate all the details of the computer's internals is called the operating system or the kernel.

 

  • Unix was originally developed in 1969 by a group of AT&T employees Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna at Bell Labs.
  • There are various Unix variants available in the market. Solaris Unix, AIX, HP Unix and BSD are a few examples. Linux is also a flavor of Unix which is freely available.
  • Several people can use a Unix computer at the same time; hence Unix is called a multiuser system.
  • A user can also run multiple programs at the same time; hence Unix is a multitasking environment.

 

Unix Architecture

Here is a basic block diagram of a Unix system

 

 

 

Q 04:                                                                                      (Each containing 5)

  1. Determine an example of 5 processes that you have assigned to the Operating system. Draw the PCB and PID table for the processes and also give the Names of the processes that you have assigned to the OS.

Answer:

process which performs all the tasks mentioned in the program.

 

When a program is loaded into the memory and it becomes a process, it can be divided into four sections ? stack, heap, text and data.

 

For example, when you want to search something on web then you start a browser. So, this can be process. Another example of process can be starting your music player to listen to some cool music of your choice.

 

Process Life Cycle

 

When a process executes, it passes through different states. These stages may differ in different operating systems, and the names of these states are also not standardized.

In general, a process can have one of the following five states at a time.

 

 

S.N.

State & Description

1

Start

This is the initial state when a process is first started/created.

2

Ready

The process is waiting to be assigned to a processor. Ready processes are waiting to have the processor allocated to them by the operating system so that they can run. Process may come into this state after Start state or while running it by but interrupted by the scheduler to assign CPU to some other process.

3

Running

Once the process has been assigned to a processor by the OS scheduler, the process state is set to running and the processor executes its instructions.

4

Waiting

Process moves into the waiting state if it needs to wait for a resource, such as waiting for user input, or waiting for a file to become available.

5

Terminated or Exit

Once the process finishes its execution, or it is terminated by the operating system, it is moved to the terminated state where it waits to be removed from main memory.

 

Process Control Block (PCB)

A Process Control Block is a data structure maintained by the Operating System for every process. The PCB is identified by an integer process ID (PID). A PCB keeps all the information needed to keep track of a process as listed below in the table –

 

S.N.

Information & Description

1

Process State

The current state of the process i.e., whether it is ready, running, waiting, or whatever.

2

Process privileges

This is required to allow/disallow access to system resources.

3

Process ID

Unique identification for each of the process in the operating system.

4

Pointer

A pointer to parent process.

5

Program Counter

Program Counter is a pointer to the address of the next instruction to be executed for this process.

6

CPU registers

Various CPU registers where process need to be stored for execution for running state.

7

CPU Scheduling Information

Process priority and other scheduling information which is required to schedule the process.

8

Memory management information

This includes the information of page table, memory limits, Segment table depending on memory used by the operating system.

9

Accounting information

This includes the amount of CPU used for process execution, time limits, execution ID etc.

10

IO status information

This includes a list of I/O devices allocated to the process.

 

The architecture of a PCB is completely dependent on Operating System and may contain different information in different operating systems. Here is a simplified diagram of a PCB –

 

Process ID

State

Pointer

Priority

Program Counter

CPU Registers

I/O information’s

Accounting Information

etc…

 

The PCB is maintained for a process throughout its lifetime, and is deleted once the process terminates.

 

PID – Process Identifier

 

Process identifier, also known as process ID or PID, is a unique number to identify each process running in an operating system such as Linux, Windows, and Unix. PIDs are reused over time and can only identify a process during the lifetime of the process, so it does not identify processes that are no longer running. This number can be used as a framework for various function calls, meaning processes can be manipulated and adjusted.

 

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE