SYSTEM
1. Discuss the various types of process.
Ans:
n operating systems (OS), processes can be categorized based on their characteristics and
functionality. Here's a brief overview:
1. User Processes vs. System Processes
User Processes: Initiated by users (e.g., applications like browsers).
System Processes: Managed by the OS for system operations (e.g., file management,
memory handling).
2. Foreground Processes vs. Background Processes
Foreground Processes: Require user interaction and run visibly (e.g., text editor).
Background Processes: Run without user interaction (e.g., daemons, services).
3. Independent Processes vs. Co-operating Processes
Independent Processes: Operate without affecting or depending on others.
Co-operating Processes: Share resources or data with other processes.
4. CPU-bound Processes vs. I/O-bound Processes
CPU-bound Processes: Require more CPU time for computation (e.g., mathematical
calculations).
I/O-bound Processes: Spend more time on input/output operations (e.g., file transfers).
5. Single-threaded Processes vs. Multi-threaded Processes
Single-threaded: Execute one thread of execution at a time.
Multi-threaded: Contain multiple threads that execute concurrently.
6. Kernel-level Processes vs. User-level Processes
Kernel-level Processes: Operate in privileged kernel mode with direct hardware access.
User-level Processes: Run in user mode with restricted hardware access.
2.Define system call? State the various categories of system calls.
Ans:
Definition of System Call
A system call is a mechanism through which a user-level application interacts with the operating
system to request services like file handling, process management, or hardware access. It acts as a
bridge between user processes and the OS kernel.
,Categories of System Calls
1. Process Control: Create, terminate, or manage processes (e.g., fork, exec).
2. File Management: Open, close, read, write, or delete files (e.g., open, write).
3. Device Management: Request or release device access (e.g., ioctl, read).
4. Information Maintenance: Retrieve or modify system data (e.g., getpid, settimeofday).
5. Communication: Enable inter-process communication (e.g., pipe, socket).
3. Explain the multithreading models with diagrams.
Ans:
Multithreading Models
Multithreading models describe the relationship between user threads (managed by applications)
and kernel threads (managed by the OS).
1. Many-to-One Model
Description: Many user threads map to one kernel thread.
Pros: Efficient, no kernel involvement for thread management.
Cons: No true parallelism; one blocking thread blocks all.
[User Thread 1]
[User Thread 2] -> [Kernel Thread]
[User Thread 3]
2. One-to-One Model
Description: Each user thread maps to a kernel thread.
Pros: True parallelism on multi-core systems.
Cons: Overhead due to kernel-level thread management.
[User Thread 1] -> [Kernel Thread 1]
[User Thread 2] -> [Kernel Thread 2]
[User Thread 3] -> [Kernel Thread 3]
3. Many-to-Many Model
Description: Many user threads map to many kernel threads.
Pros: Combines efficiency and parallelism.
Cons: More complex to implement.
[User Thread 1] ->
[User Thread 2] -> [Kernel Thread 1]
, [User Thread 3] -> [Kernel Thread 2]
4. Discuss the various threading issues.
Ans:
Threading in operating systems introduces several challenges:
1. Race Conditions
Occurs when multiple threads access shared data simultaneously, leading to unpredictable
outcomes.
2. Deadlocks
Happens when threads are waiting on each other indefinitely, causing a complete halt.
3. Starvation
Some threads may never get CPU time or access to resources due to unfair scheduling.
4. Synchronization
Ensuring correct access to shared resources using locks, semaphores, or monitors can be
complex.
5. Context Switching Overhead
Switching between threads incurs performance overhead.
6. Resource Sharing
Threads sharing resources can lead to data inconsistencies if not managed properly.
7. Portability Issues
Threading implementations vary across platforms, causing compatibility challenges.
5. Define process control block.
Ans:
Definition of Process Control Block (PCB)
A Process Control Block (PCB) is a data structure used by the operating system to store essential
information about a process, enabling efficient process management.
Key Components of PCB
1. Process ID: Unique identifier for the process.
2. Process State: Current state (e.g., Ready, Running, Waiting).
3. Program Counter: Address of the next instruction to execute.
4. CPU Registers: Stores the CPU's current state for the process.