0% found this document useful (0 votes)
8 views18 pages

Osy Summer 25

The document discusses various concepts related to operating systems, including fixed size memory partitioning, CPU scheduling, file allocation methods, and interprocess communication. It explains user-level and kernel-level threads, deadlock conditions, and different scheduling criteria. Additionally, it covers Unix commands, memory management techniques, and the differences between multiprogramming and multitasking.

Uploaded by

shubhamrajawadha
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)
8 views18 pages

Osy Summer 25

The document discusses various concepts related to operating systems, including fixed size memory partitioning, CPU scheduling, file allocation methods, and interprocess communication. It explains user-level and kernel-level threads, deadlock conditions, and different scheduling criteria. Additionally, it covers Unix commands, memory management techniques, and the differences between multiprogramming and multitasking.

Uploaded by

shubhamrajawadha
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/ 18

Q1) Explain fixed size memory partitioning.

Fixed Size Memory Partitioning (Static)


Memory is divided into number of fixed size partitions, which is
called as fixed or static memory partitioning.
Each partition contains exactly one process.
The number of programs to be executed depends on number of
partitions.
When the partition is free, a selected process from the input queue
is loaded into the free partition.
When the process terminates, the partition becomes available for
another process.
Q2) Writer the outputs of following commands
(i) Wait 2385018
(ii) Sleep 09
(iii) PS –u Asha
i) Wait command waits until the termination of specified process ID
2385018
ii) Sleep command is used to delay for 9 seconds during the execution
of a processi.e. it will pause the terminal for 9 seconds.
iii) ps command with -u is used to display data/processes for the
specific user Asha.
Q3) Explain O.S.Tools
Ans:
1.Task manager:
• A task manager is a tool that shows you the current status
and activity of your computer's processes, applications, and services.
• Assign processor to task ready for execution
• Executing predefined actions automatically whenever a
certain set of condition is met.
2.security policy:
• Security tools are programs that protect your computer from
viruses, malware, spyware, ransomware, and other threats.
• They can scan, detect, remove, and block malicious software,
and also prevent unauthorized access, data theft, and identity fraud.
Q4)Explain linked file allocation method.
Linked Allocation:
This allocation is on the basis of an individual block. Each block contains a
pointer to the next block in the chain.
The disk block can be scattered anywhere on the disk.
• The directory contains a pointer to the first and the last blocks of the file.
• To create a new file, simply create a new entry in the directory.
• The following figure shows the linked allocation.
• The size of a file need not be declared when it is created.

Q5) List any four services provided by O.S.


User Interface
Program Execution
I/O Operation
File system Manipulation
Communication
Error Detection
Q6) What is CPU Scheduler? Explain the preemptive and non-
preemptive type of scheduling
ANS; 1. CPU Scheduler: When the CPU becomes idle, the CPU scheduler selects
one of the processes in the ready queue for execution. The CPU scheduler
selects a process from the processes in memory that are ready to execute
and allocates the CPU to that process.
2. Pre-emptive scheduling: - Once the CPU is allocated to a process, the CPU
is forcefully removed from that process due to occurrence of interrupt or
completion of I/O request by the requesting process. In this scheduling, a
process changes its status from running state to ready state or waiting state
to ready state.
3. Non-Preemptive scheduling: - Once the CPU is allocated to a process, the
process keeps the CPU until it releases the CPU by terminating or by
switching to the waiting state. Control of CPU is with the process to which
it is allocated.In this scheduling, a process changes its status from running
to waiting or running to terminate.
Q7) Describe any four file attributes.
File attributes:
Name: The symbolic file name is the only information kept in
human readable form.
Identifier: File system gives a unique tag or number that
identifies file within file system and which is used to refer files
internally.
Type: This information is needed for those systems that support
different types.
Location: This information is a pointer to a device and to the
location of the file on that device.
Size: The current size of the file (in bytes, words or blocks) and
possibly the maximum allowed size are included in this attribute.
Q8) Explain user level thread and Kernel level thread with its
advantages and disadvantages
ANS;
➢ User Level Thread
In a user thread, all of the work of thread management is done by
the application and the kernel is not aware of the existence of threads.
The thread library contains code for creating and destroying threads,
for passing message and data between threads, for scheduling thread
execution and for saving and restoring thread contexts.
• Advantages of user level thread over Kernel level thread:
1. Thread switching does not require Kernel mode privileges.
2. User level thread can run on any operating system.
3. Scheduling can be application specific.
• Disadvantages of user level thread:
Blocking: If a user-level thread blocks due to I/O or other reasons, all threads
in the same process can be blocked, leading to poor utilization of resources.
➢ Kernel Level Threads
In Kernel level thread, thread management done by the Kernel.
There is no thread management code in the application area.
Kernel threads are supported directly by the operating system.
Any application can be programmed to be multithreaded.
All of the threads within an application are supported within a single process.
• Advantages of Kernel level thread:
1. Kernel can simultaneously schedule multiple threads from the
same process on multiple process.
2. If one thread in a process is blocked, the Kernel can schedule
another thread of the same process.
3. Kernel routines themselves can multithreaded.
• Disadvantages:
1. Kernel threads are generally slower to create and manage than the
user threads.
2. Transfer of control from one thread to another within same process
requires a mode switch to the Kernel.
Q9) Consider the string:
0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7 with frame size 3 and 4,
calculate page fault in both the cases using FIFO algorithm

Total Page Faults :16

Q10) Draw and explain process state diagram.


Q11) State and describe types of scheduler.
Ans; There are three types of scheduler:
Long term scheduler
Short term scheduler
Medium term scheduler

1. Long term scheduler:


It selects programs from job pool and loads them into the main memory. It controls the
degree of multiprogramming. The degree of multiprogramming is the number of
processes loaded (existing) into the main memory. System contains I/O bound processes
and CPU bound processes.
2. Short term scheduler:
It is also known as CPU scheduler. This scheduler selects processes that are ready for
execution from the ready queue and allocates the CPU to the selected process.
Frequency of execution of short term scheduler is more than other schedulers.
3.Medium term scheduler:
When a process is in running state, due to some interrupt it is blocked. System swaps out
blocked process and store it into a blocked and swapped out process queue. When space
is available in the main memory, the operating system looks at the list of swapped out
but ready processes.
Q12). Describe sequential and direct access method
Ans:
• Sequential access: Information from the file is processed in order i.e. one record
after another. It is commonly used access mode. For example, editors and
compilers access files in sequence. A read operation read information from the file
in a sequence i.e. read next reads the next portion of the file and automatically
advances a file pointer
• Direct access: It is also called as relative access. A file is made up of fixed length
logical records that allow programs to read and write records rapidly in no
particular order. Direct access method is based on disk model of a file which allows
random access to any file block.
Q13) Consider the following memory map and assume a new process P4 comes with
memory requirements of 6 KB. Locate (Draw) this process in memory using.
ANS;

Q14) Define : Process, PCB


Process:-A process is a program in execution. Process is also called as job, task or unit of
work
PCB:-Process Control Block is a data structure that contains information of the process
related to it. The process control block is also known as a task control block, entry of the
process table, etc
Q15) Define CPU and I/O burst cycle.
CPU burst cycle: It is a time period when process is busy with CPU.
I/O burst cycle: It is a time period when process is busy in working with I/O resources.
Q16) Describe message passing system of interprocess communication
(IPC)
Message Passing: In this model, communication takes place by exchanging messages
between cooperating processes. It allows processes to communicate and synchronize
their action without sharing the same address space. It is particularly useful in a
distributed environment when communication process may reside on a different
computer connected by a network. Communication requires sending and receiving
messages through the kernel.

Q17) Define deadlock. State the conditions necessary for deadlock.


Deadlock is defined as, "a situation where a set of processes are
blocked because each process is holding a resource and waiting for
another resource acquired by some other process".
Necessary Conditions to Deadlock:
• Mutual Exclusion: At least one resource is held in a non-sharable mode, that is only
one process at a time can use the resource. If another process requests that
resource, the requesting process must be delayed until the resource has been
released. Each resource is either currently assigned to exactly one process or is
available.
• Hold and Wait: There must exist a process that is holding at least one resource and
is waiting to acquire additional resources that are currently being held by another
process. Process currently holding resources granted earlier can request new
resources.
No Pre-emption: Resources cannot be pre-empted; i.e. resource can only be
released voluntarily by the process holding it, after the process has completed its
task. Resources previously granted cannot be forcibly taken away from a process.
They must be explicitly released by the process holding them.
Q18) Define Process. Draw a Process Control Block and explain the
information in PCB
ANS: Process: A process is defined as, a program under execution, whichcompetes for the
CPU time and other resources.
A process is a program in execution. Process is also called as job, task
and unit of work.

Accounting Information: This information includes the amount of CPU and real time used,
time limits, account numbers, job or process numbers, and so on.
I/O Status Information: This information includes the list of I/O
devices allocated to the process, a list of open files, and so on.
File Management: It includes information about all open files,
access rights etc.
Pointer: Pointer points to another process control block. Pointer
is used for maintaining the scheduling list.
Q) State two features of non-preemptive scheduling 2M
Once CPU is allocated to the process, the process keeps the CPU until it releases the
CPU either by terminating or by switching to the waiting state.
A process switches from running state to waiting state or running to terminated state.
Low scheduling overhead.
Simple to implement and manage.
Less responsive in terms of priority for urgent task.
Q19) Write Unix command for following:
i)create a folder OSY ii) create a file FIRST in OSY folder
iii) List/display all files and directories.
iv) Write command to clear the screen
ANS i) create a folder OSY:
$mkdir OSY
ii)create a file FIRST in OSY folder:
$cd OSY
$cat>FIRST or $ touch FIRST
iii) List/display all files and directories:
$ls
iv) to clear screen:
$clear

Q20) Difference between Multiprogramming and multitasking


Q21) Difference between user level and kernel level thread.

Q22) Difference between GUI and CLI


Q23) Describe I/O Burst and CPU Burst cycle with neat diagram.
i) A process execution consists of a cycle of CPU execution and I/O wait.
ii) A process starts its execution when CPU is assigned to it, so process execution begins
with a CPU burst cycle.
Iii) This is followed by an I/O burst cycle when a process is busy doing I/O operations.
iv) A process switch frequently from CPU burst cycle to I/O burst cycle and vice versa.

Q24) Describe how context switch is executed by operating system


Ans: 1)When CPU switches to another process, the system must save the state of the old
process and load the saved state for the new process. This task is known as a context
switch
2)CPU switching from one process to another process is called a context switch.
3)Context switch times are highly dependent on hardware support. Its speed varies from
machine to machine, depending on the memory speed, the number of registers that must
be copied and the existence of special instructions.
Q25) Explain the use of following OS tools: i) Device Manager ii) Task Scheduler
Device Manager use 1) Managing all the hardware or virtual devices of computer system.
2) Allow interaction with hardware devices through device driver.
3) Allocate devices to the process as per process requirement and priority.
Task scheduler use : 1) Used to automate the execution of programs, scripts, and
various tasks at specific intervals or specific events.
2. Used to select the next jobs to be admitted into the system and the next process
to run.
3. Schedules tasks on CPU. Which task to run first, which has high
priority, which has low latency is decided by schedulers.
Q26) Explain user level thread and Kernel level thread with its advantages and disadvan
User Level Thread: 1)The application begins with a single thread and begins running in
that thread.
2) User level threads are generally fast to create and manage.
Advantages: Scheduling can be application specific.
Disadvantages: It is not appropriate for a multiprocessor system.
Kernal Level threads: 1) In Kernel level thread, thread management done by the Kernel.
2) There is no thread management code in the application area.
3) Any application can be programmed to be multithreaded.
Advantages: Kernel routines themselves can multithreaded.
Disadvantages: Kernel threads are generally slower to create and manage than the
user threads.
Q) Write syntax of PWD command and explain its use with the help of suitable example.
Syntax: $ pwd
PWD command is used to print (display) current working directory.
Example: $ pwd
Above example displays absolute pathname.
Output: /home/poly
Q27) Explain bit map vector and linked list free space manag techni with its Adva & Disad
1)Bitmap Vector: The free-space list is implemented as a bit map or bit vector. Each block
is represented by 1 bit. If the block is free, the bit is 1; if the block is allocated, the bit is 0.
Advantages: Simple and easy to understand.
Disadvantages : The operating system goes through all the blocks until it finds
a free block.
2) Linked List: In this approach, the free disk blocks are linked together i.e. a free block
contains a pointer to the next free block. The block number of the very first disk block is
stored at a separate location on disk and is also cache in memory
Advantages: No extra space for the free list.
Disadvantages: Random access is virtually impossible. Lots of seeking, even
in sequential access.
Q28) Explain the following terms with respect to memory management: i) Dynamic
relocation ii) Swapping
Dynamic Relocation: When a program gets swapped out to a disk memory, then it is not
always possible that when it is swapped back into main memory then it occupies the
previous memory location, since the location may still be occupied by another process.
Swapping: Swapping is mechanism in which a process can be swapped temporarily out of
main memory (or move) to secondary storage (disk) and make that memory available to
other processes. At some later time, the system swaps back the process from the
secondary storage to main memory.
Q29) Describe different scheduling criteria.
CPU utilization: - In multiprogramming the main objective is to keep CPU as busy as
possible. CPU utilization can range from 0 to 100 percent.
Throughput: - It is the number of processes that are completed per unit time. It is a
measure of work done in the system. When CPU is busy in executing processes, then work
is being done in the system. Throughput depends on the execution time requiredfor any
process.
Turnaround time: -The time interval from the time of submission of a process to the time
of completion of that process is called as turnaround time. It is the sum of time period
spent waiting to get into the memory, waiting in the ready queue, executing with the
CPU, and doing I/O operations.
Waiting time: - It is the sum of time periods spent in the readyqueue by a process. When
a process is selected from job pool, it is loaded into the main memory. A process waits in
ready queue till CPU is allocated to it.
Q30) Difference betwn short,long,medium term

Q) Define following terms: i. Memory compaction ii. Fragmentation


i. Memory compaction:
The process of shuffling the memory contents so as to place all free memory together in
one large block is known as memory compaction.
ii. Fragmentation:
When processes are loaded and removed from memory, the free memory space is broken
into little pieces which is known as fragmentation.
Q31) Construct and explain directory structure of a file system in
terms of two level and tree structure.
ANS; 1) Two-level directory: - In the two-level structures, each user has its own user file
directory (UFD). The UFD lists only files of a single user. System contains a master file
directory (MFD) which is indexed by user name or account number. Each entry in MFD
points to the UFD for that user. When a user refers to a particular file, only his own UFD is
searched. Different users can have files with the same name, as long as all the file names
within each UFD are unique.

2. Tree structure:- In this directory structure user can create their own sub-directories and
directory contains a set of files or subdirectories. All directories have the same internal
format. One bit in each directory entry defines the entry as a file (0) or as a subdirectory
(1). Each process has a current directory.
Q32) Describe any four file attributes
Ans ; File attributes:
Name: The symbolic file name is the only information kept in human readable form.
Identifier: File system gives a unique tag or number that identifies file within file system
and which is used to refer files internally.
Type: This information is needed for those systems that support different types.
Location: This information is a pointer to a device and to the location of the file on that
device.
Q) List components of OS. Explain process management in detail.
List of System Components:
1. Process management
2. Main memory management
3. File management
4. I/O system management
5. Secondary storage management
Q) Define virtual memory
Virtual memory is a memory management capability of an operating system (OS) that
uses hardware and software to allow a computer to compensate for physical memory
shortages by temporarily transferring data from random access memory (RAM) to disk
storage.
Q) Define real time operating system. List its any four applications of it.
The real-time operating system used for a real-time application means for those
applications where data processing should be done in the fixed and small quantum of
time.
Types of real time operating system
1. Hard real-time
2. Soft real-time
Applications: 1. Flight Control System 2. Simulations
3. Industrial control 4. Military applications
Q32) Solve given problem by using SJF and FCFS scheduling algorithm using Gantt chart.
Calculate the average waiting time for each algorithm

ANS; Gantt Chart SJF

Waiting Time
P1=17
P2=3
P3=0
P4=10
Average waiting time=Waiting time of all processes / Number of processes
=(17+3+0+10) /4
=30/4
=7.5 milliseconds (ms)
Gantt Chart FCFS

Waiting Time
P1=0 P2=9
P3=16 P4=19
Average waiting time=Waiting time of all processes / Number of
processes
=(0+9+16+19) /4
=44/4
=11 milli seconds (ms)

You might also like