0% found this document useful (0 votes)
12 views

Notes

The document provides an overview of operating systems, detailing their functions such as program execution, access to I/O devices, and system access. It explains various concepts including process states, microkernel architecture, multithreading, scheduling criteria, system calls, and inter-process communication. Additionally, it discusses specific problems like the critical section problem and the producer-consumer problem, along with their solutions.

Uploaded by

nayosrkr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Notes

The document provides an overview of operating systems, detailing their functions such as program execution, access to I/O devices, and system access. It explains various concepts including process states, microkernel architecture, multithreading, scheduling criteria, system calls, and inter-process communication. Additionally, it discusses specific problems like the critical section problem and the producer-consumer problem, along with their solutions.

Uploaded by

nayosrkr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

1)What are operating systems? Explain functions in detail.

An OS is a program that controls the execution of application programs and acts as an


interface between applications and the computer hardware.
Functions Provided by OS
• Program execution: A number of steps need to be performed to execute a program.
Instructions and data must be loaded into main memory, I/O devices and files must be
initialized, and other resources must be prepared.
• Access to I/O devices: The OS provides a uniform interface that hides details so that
programmers can access such devices using simple reads and writes.
• System access: For shared or public systems, the OS controls access to the system as a
whole and to specific system resources. The access function must provide protection of
resources and data from unauthorized users and must resolve conflicts for resource contention.
• Program development: The OS provides a variety of facilities and services, such as editors
and debuggers, to assist the programmer in creating programs. These services are in the form
of utility programs that, while not strictly part of the core of the OS, are supplied with the OS
and are referred to as application program development tools.

2) Draw and Explain five state process models.

• New: A process that has just been created but has not yet been admitted to the pool of
executable processes by the OS. Typically, a new process has not yet been loaded into main
memory, although its process control block has been created.
• Running: The process that is currently being executed. For this chapter, we will assume a
computer with a single processor, so at most one process at a time can be in this state.
• Ready: A process that is prepared to execute when given the opportunity.
• Blocked/Waiting:4 A process that cannot execute until some event occurs, such as the
completion of an I/O operation.
• Exit: A process that has been released from the pool of executable processes by the OS,
either because it halted or because it aborted for some reason.
3) Describe Microkernel with a diagram.

This structure designs the operating system by removing all non-essential components from
the kernel and implementing them as system and user programs.
This result in a smaller kernel called the micro-kernel.
Advantages of this structure are that all new services need to be added to user space and
does not require the kernel to be modified.
Thus it is more secure and reliable as if a service fails then rest of the operating system
remains untouched. Mac OS is an example of this type of OS.

Advantages of Micro-kernel structure:


• It makes the operating system portable to various platforms.
• As microkernel's are small so these can be tested effectively.

Disadvantages of Micro-kernel structure:


• Increased level of inter module communication degrades system performance.

4) Discuss the importance of “Multithreading”. Differentiate Between kernel


thread and user thread.

Multithreading refers to the ability of an OS to support multiple, concurrent paths of


execution within a single process.
The traditional approach of a single thread of execution per process, in which the concept of
a thread is not recognized, is referred to as a single-threaded approach.
In a multithreaded environment, a process is defined as the unit of resource allocation and
a unit of protection. The following are associated with processes:
• A virtual address space that holds the process image
• Protected access to processors, other processes (for interprocess communication), files,
and I/O resources (devices and channels)
5) Differentiate between short term, medium term and long term scheduler
with a diagram.

6) Explain the difference between Monolithic and Micro Kernel structure.


7) What is a System call? Explain any 4 in detail.

• Programming interface to the services provided by the OS


• Typically written in a high-level language (C or C++)
• Mostly accessed by programs via a high-level Application Program Interface (API) rather
than direct system call use
• Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based
systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the
Java virtual machine (JVM)
Types of System Calls
I. Process control
II. File management
III. Device management
IV. Information maintenance
V. Communications

• Process control
o end, abort
o load, execute
o create process, terminate process
o get process attributes, set process attributes
o wait for time
o wait event, signal event
o allocate and free memory

• File management
o create file, delete file
o open, close
o read, write, reposition
o get file attributes, set file attributes

• Device management
o request device, release device
o read, write, reposition
o get device attributes, set device attributes
o logically attach or detach devices

• Information maintenance
o get time or date, set time or date
o get system data, set system data
o get process, file, or device attributes
o set process, file, or device attributes

• C ommunica tions
o create, delete communication connection
o send, receive messages
o transfer status information
o attach or detach remote devices
8) Explain Layered structure.

• An OS can be broken into pieces and retain much more control on system.
• In this structure the OS is broken into number of layers (levels).
• The bottom layer (layer 0) is the hardware and the topmost layer (layer N) is the user
interface.
• These layers are so designed that each layer uses the functions of the lower level layers only.
• This simplifies the debugging process as if lower level layers are debugged and an error
occurs during debugging then the error must be on that layer only as the lower level layers
have already been debugged.

Advantages of Layered structure:


• Layering makes it easier to enhance the operating system as implementation of a layer can
be changed easily without affecting the other layers.
• It is very easy to perform debugging and system verification.

Disadvantages of Layered structure:

• In this structure the application performance is degraded as compared to simple structure.


• It requires careful planning for designing the layers as higher layers use the functionalities
of only the lower layers.
9) Explain Shell. Explain use of chmod command in linux.
Shell is the interface which takes input from Users and sends instructions to the Kernel, Also
takes the output from Kernel and send the result back to output shell.
The Shell is also known as an Interpreter which is used to translate program in assembly
language to machine language and then the made request is transferred to the Kernel.
TYPES:-
1. Korn shell
2. Bourne Shell
3. C shell
4. POSIX shell

chmod is a command that lets you change the permissions of a file or directory to all types of
users. You can grant or revoke the permission by using chmod command.

10) Discuss various scheduling criteria.

CPU Utilization

Throughput: Number of processes completed per unit time


Turnaround time: the interval from the time of submission of a process to the time of
completion
Turn Around Time = Completion Time - Arrival Time.
Waiting time: sum of periods spend waiting in the ready queue
Waiting Time = Turnaround Time - Burst Time.
Response time: Time taken to start responding
Response Time = CPU Allocation Time(when the CPU was allocated for the first) -
Arrival Time
Maximize CPU utilization, Maximize throughput, minimize turnaround time, waiting time and
response time.
11) Explain PCB OF Process in detail.

Process can be uniquely characterized by a number of elements, including the following:


• Identifier: A unique identifier associated with this process, to distinguish it from all other processes.
• State: If the process is currently executing, it is in the running state.
• Priority: Priority level relative to other processes.
• Program counter: The address of the next instruction in the program to be executed.
• Memory pointers: Includes pointers to the program code and data associated with this process, plus
any memory blocks shared with other processes.
• Context data: These are data that are present in registers in the processor while the process is
executing.
• I/O status information: Includes outstanding I/O requests, I/O devices (e.g.,disk drives) assigned to
this process, a list of files in use by the process, and so on.
• Accounting information: May include the amount of processor time and clock time used, time limits,
account numbers, and so on.
12) What is the critical section problem ?Explain the hardware solution
proposed to achieve the same(TSL).
Consider a system consisting of n processes { Po, P1, ..., Pn }
Each process has a segment of code, called a critical section in which the process may be
changing common variables, updating a table, writing a file, and so on.
When one process is executing in its critical section, no other process is to be allowed to
execute in its critical section.
That is, no two processes are executing in their critical sections at the same time.
Test and Set Lock
A hardware solution to the synchronization problem.
There is a shared locked variable which can take either of the two values, 0 or 1.
Before entering into the critical section, a process inquires about the lock.
If it is locked, it keeps on waiting till it becomes free.
If it is not locked, it takes the lock and executes the critical section.

13) What are semaphores? Explain Binary semaphores in detail.


Semaphore proposed by Edsger Dijkstra, is a technique to manage concurrent processes by
using a simple integer value, which is known as a semaphore.
Semaphore is simply a variable which is non-negative and shared between threads. This
variable is used to solve the critical section problem and to achieve process synchronization in
the multiprocessing environment.
A semaphore S is an integer variable that, apart from initialization, is accessed only through
two standard atomic operations: wait ( ) and signal ( ).
wait ( ) → P [from the Dutch word proberen, which means "to test")
signal ( ) → V [from the Dutch word verhogen, which means "to increment")

Binary Semaphores: The binary semaphores are like counting semaphores but their value is
restricted to 0 and 1. The wait operation only works when the semaphore is 1 and the signal
operation succeeds when semaphore is 0. It is sometimes easier to implement binary
semaphores than counting semaphores.

14)What is the producer consumer problem? provide solutions to solve


problems using Semaphores..
● In operating System Producer is a process which is able to produce data/item.
● Consumer is a Process that is able to consume the data/item produced by the Producer.
● Both Producer and Consumer share a common memory buffer. This buffer is a space of a
certain size in the memory of the system which is used for storage. The producer produces the
data into the buffer and the consumer consumes the data from the buffer.
Solution For Producer Consumer Problem
To solve the Producer-Consumer problem three semaphores variable are used :
Semaphores are variables used to indicate the number of resources available in the system at
a particular time. semaphore variables are used to achieve `Process Synchronization.
● Full - The full variable is used to track the space filled in the buffer by the Producer process.
It is initialized to 0 initially as initially no space is filled by the Producer process.
● Empty - The Empty variable is used to track the empty space in the buffer. The Empty
variable is initially initialized to the BUFFER-SIZE as initially, the whole buffer is empty.
● Mutex - Mutex is used to achieve mutual exclusion. mutex ensures that at any particular time
only the producer or the consumer is accessing the buffer.
15) Explain Inter process communication in detail.

Inter-process communication (IPC) is a mechanism that allows processes to communicate


with each other and synchronize their actions. The communication between these processes
can be seen as a method of co-operation between them. Processes can communicate with
each other through both:
● Shared Memory
● Message passing

Advantages of IPC:
• Enables processes to communicate with each other and share resources, leading to
increased efficiency and flexibility.
• Facilitates coordination between multiple processes, leading to better overall system
performance.
• Allows for the creation of distributed systems that can span multiple computers or networks.

Disadvantages of IPC:
• Increases system complexity, making it harder to design, implement, and debug.
• Can introduce security vulnerabilities, as processes may be able to access or modify data
belonging to other processes.

Examples of IPC systems

1. Posix : uses shared memory method.


2. Mach : uses message passing
3. Windows XP : uses message passing using local procedural calls
16)

17)

18) consider the following set of the processes.

1. Draw Gantt chart for FCFS, SJF(Preemptive) and Round Robin (Quantum=2). 2.
Also calculate average waiting time and turnaround time for above scheduling
algorithms.

19) consider the following set of the processes.


1. Draw Gantt chart for SJF(Preemptive) and Priority (Preemptive).
2. Also calculate average waiting time and turnaround time for above scheduling
algorithms.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy