Nothing Special   »   [go: up one dir, main page]

Os Assignment

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

1. Name different types of operating systems.

Different Types of Operating Systems:

Windows (e.g., Windows 10, Windows 11)

macOS (e.g., macOS Big Sur)

Linux (e.g., Ubuntu, CentOS)

Unix (e.g., AIX, HP-UX)

Android (for mobile devices)

iOS (for Apple mobile devices)

Real-time operating systems (RTOS)

Embedded operating systems (e.g., FreeRTOS)

Network operating systems (e.g., Cisco IOS)

Distributed operating systems (e.g., Google's Fuchsia)

2. What do you mean by operating system?

An Operating System (OS) is an interface between a computer user and computer hardware. An
operating system is a software which performs all the basic tasks like file management, memory
management, process management, handling input and output, and controlling peripheral devices
such as disk drives and printers.

3. What is Kernel?

Kernel is central component of an operating system that manages operations of computer and
hardware. It basically manages operations of memory and CPU time. It is core component of an
operating system

4. What is the difference between process and thread?

Process Thread

A process is an instance of a Thread is a segment of a process


program that is being or a lightweight process that is
executed or processed. managed by the scheduler
independently.

Processes are independent Threads are interdependent and


of each other and hence share memory.
don't share a memory or
other resources.
Each process is treated as a The operating system takes all the
new process by the user-level threads as a single
operating system. process.

If one process gets blocked If any user-level thread gets


by the operating system, blocked, all of its peer threads also
then the other process can get blocked because OS takes all of
continue the execution. them as a single process.

5. What is page fault?

In computing, a page fault (sometimes called PF or hard fault) is an exception that the memory
management unit (MMU) raises when a process accesses a memory page without proper
preparations. Accessing the page requires a mapping to be added to the process's virtual address
space.

6. Which one is the best page replacement algorithm?

Optimal page replacement is the best page replacement algorithm as this algorithm results in the
least number of page faults. In this algorithm, the pages are replaced with the ones that will not be
used for the longest duration of time in the future.

7. Why there is need of Paging?

Paging is a memory management scheme used to overcome the limitations of contiguous memory
allocation. It increases the memory space available for applications and processes by using disk space
as an extension of physical memory.

8. What do you understand by compaction method in memory management?

Compaction is a technique to collect all the free memory present in the form of fragments into one
large chunk of free memory, which can be used to run other processes. Compaction can be done
only when the relocation is dynamic and done at execution time.

9. How do we avoid race conditions and what are lock variables?

To prevent the race conditions from occurring, you can lock shared variables, so that only one thread
at a time has access to the shared variable. Lock variable is a synchronization mechanism. It uses a
lock variable to provide the synchronization among the processes executing concurrently.
10. What is Critical Region? How do they relate to controlling access to shared resources?

In an operating system, a critical region refers to a section of code or a data structure that must be
accessed exclusively by one method or thread at a time.

11. Define Peterson Method with example.

Peterson's algorithm (or Peterson's solution) is a concurrent programming algorithm for mutual
exclusion that allows two or more processes to share a single-use resource without conflict, using
only shared memory for communication

For example, let int a=5, and there are two processes p1 and p2 that can modify the value of a. p1
adds 2 to a a=a+2 and p2 multiplies a with 2, a=a*2.

12. Explain first fit, best fit, next fit and worst fit in memory management.

Memory Management (Allocation) Algorithms:

 First Fit: Allocates the first available memory block that is large enough to accommodate the
process.

 Best Fit: Allocates the smallest available memory block that fits the process's size, minimizing
wasted memory.

 Next Fit: Similar to First Fit but starts searching for available memory from the last allocation
point.

 Worst Fit: Allocates the largest available memory block, potentially leading to more
fragmentation.

13. Write a short note on paging

Paging is a function of memory management where a computer will store and retrieve data from a
device's secondary storage to the primary storage. The primary concept behind paging is to break
each process into individual pages. Thus the primary memory would also be separated into frames.

14. Write a short note on segmentation.

Segmentation is the process of dividing potential customers into groups based on similar interests or
characteristics.

Segment table contains mainly two information about segment:

1. Base: It is the base address of the segment

2. Limit: It is the length of the segment.

15. What do you mean by Semaphores? Explain the types of Semaphores with example.

Semaphores are compound data types with two fields one is a Non-negative integer S.V. and the
second is a set of processes in a queue S.L. It is used to solve critical section problems, and by using
two atomic operations, it will be solved
There are two main types of semaphores i.e. counting semaphores and binary semaphores

Counting Semaphores

These are integer value semaphores and have an unrestricted value domain. These semaphores are
used to coordinate the resource access, where the semaphore count is the number of available
resources.

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.

16. What is the purpose of a TLB? Explain the TLB lookup with the help of a block diagram, explaining
the hardware required.

A translation lookaside buffer (TLB) is a memory cache that stores the recent translations of virtual
memory to physical memory. It is used to reduce the time taken to access a user memory location.

TLB Lookup:

 When a CPU wants to access a memory location, it first checks the TLB for a mapping.

 If a mapping is found (TLB hit), the physical address is retrieved.

 If a mapping is not found (TLB miss), the CPU accesses the page table in main memory to find
the mapping and stores it in the TLB for future use.
17. What is meant by virtual memory? With the help of a block diagram explain the data structures
used.

Virtual Memory is a storage allocation scheme in which secondary memory can be addressed as
though it were part of the main memory.

Virtual memory is a memory management technique that uses a combination of RAM and secondary
storage (e.g., disk) to provide the illusion of a larger memory space than physically available. It uses
data structures like page tables to map virtual addresses to physical addresses.

18. What do you understand by paging? Why there is need of multilevel paging?

Paging is a function of memory management where a computer will store and retrieve data from a
device's secondary storage to the primary storage. The primary concept behind paging is to break
each process into individual pages. Thus the primary memory would also be separated into frames.

Multilevel paging extends this concept by using multiple levels of page tables to manage larger
address spaces more efficiently, reducing the memory overhead of a single-level page table.

You might also like