Thread

In computer science, a thread is a lightweight process that can execute concurrently with other threads within the same process. Threads share the same memory space and system resources, but each thread has its own execution stack and program counter. Multithreading refers to the ability of a program to create multiple threads that can execute simultaneously. Multithreading provides several benefits over single-threaded programs, such as improved performance and responsiveness.

Benefits of Multithreading

Multithreading offers several benefits over single-threaded programs:

Improved Performance

Multithreading can improve the performance of a program by allowing multiple tasks to execute concurrently. For example, a program that performs both input/output operations and computations can use separate threads for each task, allowing them to execute simultaneously and reducing overall execution time.

Enhanced Responsiveness

Multithreading can improve the responsiveness of a program by allowing it to continue executing while waiting for a blocking operation to complete. For example, a graphical user interface can use a separate thread to handle user input, allowing the program to remain responsive while waiting for user actions.

Resource Sharing

Threads share the same memory space and system resources, allowing them to communicate and share data efficiently. This can simplify programming and reduce memory usage.

Simplicity

Multithreading can simplify programming by allowing complex tasks to be split into smaller, more manageable pieces. Each thread can focus on a specific task, making the program easier to understand and debug.

Resources Used When a Thread is Created

When a thread is created, several resources are used, including:

Memory

Each thread has its own stack and execution context, which requires memory. The amount of memory used by a thread depends on the size of its stack and the data it stores.

CPU Time

Each thread requires CPU time to execute. When multiple threads are running simultaneously, the operating system allocates CPU time to each thread based on its priority and the amount of work to be done.

Synchronization Objects

Threads that share data or resources must use synchronization objects, such as semaphores or mutexes, to avoid conflicts and ensure correctness. These objects require system resources, such as memory and CPU time.

Overhead

Creating and managing threads requires additional overhead, such as context switching and scheduling, which can reduce performance.


OS-2022

Q-1.

(a) Write are the functions of operating systems? write a note on multi programmed operating systems ?

(b) Distinguish between client server and peer to peer model of distributed systems .

Q-2.

(a) With a Neat Sketch, Describe the services that an Operating System provides to users, processes and other systems.

(b) What is meant by Storage Structure? Discuss Storage Hierarchy.

(c) Write the Advantages and Disadvantages of using the same system call interface for manipulating both Files and Devices.

Q-3.

(a) What are the criteria for evaluating the CPU scheduling algorithms? Why do we need it?

(b) Define process. Explain various steps involved in change of a process state with process state neat transition diagram.

Q-4.

(a) What is synchronization? Explain how semaphores can be used to deal with n-process critical problem.

(b) Define a thread. Give the benefits of multithreading. What resources are used when a thread is created?

Q-5.

(a) How dose deadlock avoidance differ from deadlock prevention? Write about deadlock avoidance algorithm in detail.

(b) Different between external fragmentation and internal fragmentation. How to solve the fragmentation using paging?

Q-6.

(a) What is the purpose of paging the page table? Consider the following page reference string 1,2,3,4,5,1,2,3,4,5 for a memory with three frames. How many page faults would LRU and FIFO replacement algorithm?

(b) What are the disadvantages of single contiguous memory allocation? Explain.

Q-7.

(a) Briefly explain about single-level, two-level and three Structured directories.

(b) What is disk scheduling? Explain the C-SCAN scheduling by giving an example.

Q-8.

(a) Interrupt and spooling.

(b) UNIX file system.

(c) Program and system threats.

JOIN OUR NEWSLETTER
And get notified everytime we publish a new blog post.