OS MI Assignment - 1: 1. Fixed Partition (Static) Scheme

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

OS MI Assignment -1

Question 1: Write a short note on operating system services.

Ans: An Operating System provides services to both the users and to the programs which
provides programs an environment to execute and users the services to execute the programs
in a convenient manner. List of common services offered by an almost all operating systems:

1. User Interface: e.g. CLI, GUI

2. Program Execution

3. File system manipulation

4. Input / Output Operations

5. Communication

6. Resource Allocation

7. Error Detection

8. Accounting

9. Security and protection

Question 2: Discuss process scheduling.

Ans: The process scheduling is the activity of the process manager that handles the removal
of the running process from the CPU and the selection of another process on the basis of a
particular strategy. Process scheduling is an essential part of a Multiprogramming operating
systems. Such operating systems allow more than one process to be loaded into the
executable memory at a time and the loaded process shares the CPU using time multiplexing.

Question 3: Explain memory management without swapping or paging.

Ans: Contiguous Memory - In this technique, memory is allotted in a continuous way to the
processes. It has two types:

1. Fixed Partition(static) Scheme:

• This is the oldest and simplest technique used to put more than one processes in the
main memory. In this partitioning, number of partitions (non-overlapping) in RAM
are fixed but size of each partition may or may not be same. As it
is contiguous allocation, hence no spanning is allowed. Here partition are made
before execution or during system configure.

• Internal Fragmentation: – Allocated memory may be slightly larger than requested


memory; this size difference is memory internal to a partition, but not being used
• External Fragmentation: – Total memory space exists to satisfy a request, but it is
not contiguous

• Limit in processes size.

• Limitation on degree of multi programming

2. Variable Partitioning (or) Dynamic Partitioning:

 It is used to alleviate the problem faced by Fixed Partitioning. In contrast with fixed
partitioning, partitions are not made before the execution or during system
configure. No internal fragmentation.

 Initially RAM is empty and partitions are made during the run-time according to
process’s need instead of partitioning during system configure. The size of partition
will be equal to incoming process. The partition size varies according to the need of
the process so that the internal fragmentation can be avoided to ensure efficient
utilization of RAM.

3. Buddy System:

 Static partition schemes suffer from the limitation of having the fixed number of
active processes and the usage of space may also not be optimal. The buddy system is
a memory allocation and management algorithm that manages memory in power of
two increments. Assume the memory size is 2U, suppose a size of S is required.

 If 2U-1<S<=2U: Allocate the whole block

 Else: Recursively divide the block equally and test the condition at each time, when it
satisfies, allocate the block and get out the loop

 System also keep the record of all the unallocated blocks each and can merge these
different size blocks to make one big chunk.

Question 4: Explain system call concept

Ans: A system call is the programmatic way in which a computer program requests a service
from the kernel of the operating system it is executed on. A system call is a way for programs
to interact with the operating system. A computer program makes a system call when it
makes a request to the operating system’s kernel. It provides an interface between a process
and operating system to allow user-level processes to request services of the operating
system.

Question 5: Explain operating system and importance?

Ans: An operating system is the most important software that runs on a computer. It manages
the computer's memory and processes, as well as all its software and hardware. It also allows
users to communicate with the hardware without knowing the underlying processes. Without
an operating system, a computer hardware is useless.
Question 6: Explain assemblers, compiler, interpreter, linkers

Ans:

 An assembler translates assembly language programs into machine code. The output
of an assembler is called an object file, which contains a combination of machine
instruction as well as the data required to place these instructions in memory.
 A compiler is a computer program (or a set of programs) that transforms source code
written in a programming language (the source language) into another computer
language (the target language). Typically, from high level source code to low level
machine code or object code.
 An interpreter is a common kind of language processor. Instead of producing target
program as a translation, an interpreter appears to directly execute the operations
specified in the source program on inputs supplied by the user. In contrast, an
interpreter reads a statement from the input, converts it to an intermediate code,
execute it, then takes the next statement in sequence. If an error occurs, an interpreter
stops execution and reports it.

Question 7: Discuss operating system structure

Question 8: A semaphore is a blocking synchronization primitive. Describe how they work


with the aid of pseudo-code. You can assume the existence of a thread_block() and a
thread_wakeup() function.

Question 9: Consider three process, all arriving at time zero, with total execution time of 10,
20 and 30 units, respectively. Each process spends the first 20% of execution time doing I/O,
the next 70% of time doing computation, and the last 10% of time doing I/O again. The
operating system uses a shortest remaining compute time first scheduling algorithm and
schedules a new process either when the running process gets blocked on I/O or when the
running process finishes its compute burst. Assume that all I/O operations can be overlapped
as much as possible. For what percentage of does the CPU remain idle?

Ans: https://www.geeksforgeeks.org/gate-gate-cs-2006-question-65/

Question 10: Consider the set of 4 processes whose arrival time and burst time are given
below- If the CPU scheduling policy is Shortest Remaining Time First, calculate the average
waiting time and average turnaround time.

You might also like