Operating System IPC Protocols

WelcomeMoldavite9982 avatar
WelcomeMoldavite9982
·
·
Download

Start Quiz

Study Flashcards

40 Questions

What is one reason why a developer may need to understand the OS during development and debug?

To understand how the OS performs input/output operations

What is a potential impact on an application's performance due to a system event?

Power events

Why may an application need to interface with a custom device?

To leverage the OS capabilities

What is one responsibility of an OS?

To abstract the complexities of the underlying hardware

What is a potential reason for an application's slow performance?

Frequent creation and swapping of pages in memory

What may be required to grant permissions and access to a user of an application?

Following standard protocols provided by the OS

What may affect an application's performance due to the scheduling policy?

Both A and B

Why is it important to understand the OS offerings for messaging between applications?

To choose the correct IPC protocol

What is the purpose of an Operating System in managing process states?

To monitor and manage the transition of process states seamlessly

Which of the following is NOT a state of a process in its lifecycle?

Suspended

What does the 'Priority' field in a Process Control Block (PCB) refer to?

The priority level of the process (e.g., high, medium, low)

What is the main reason why an OS tries to limit frequent transitions between CPU cores?

To reduce context switching overhead

What information does the 'I/O status information' field in a PCB store?

The current state of process I/O operations

What is the purpose of the 'Process ID' field in a PCB?

To provide a unique identifier for the process instance

What is the purpose of the direct memory access controller in DMA?

To interrupt the CPU after a specific data transfer is complete

What does the 'Pointer' field in a PCB refer to?

The hierarchy of processes

What is an intermediate layer that acts as a buffer to report data faster?

Cache

What is the 'Ready' state of a process in its lifecycle?

The process is waiting to be assigned to a processor

What is the mechanism where the OS grants authority to another controller to interrupt the CPU?

DMA

What contains the addresses for all Interrupt Service Routines (ISR) in Interrupt-Driven I/O?

Interrupt vector

What is the purpose of polling or programmed I/O?

To examine interrupt information and call a specific routine

What is unique for each device in Interrupt-Driven I/O?

IRQ

What is the main difference between polling and Interrupt-Driven I/O?

Polling examines interrupt information while Interrupt-Driven I/O uses an interrupt vector

What type of I/O is commonly used by most OSs?

Interrupt-Driven I/O

What is the primary reason why an OS needs to ensure that a file is not moved or deleted when it is in use?

To ensure concurrency and prevent inconsistent updates

What is the purpose of a garbage collector in an OS?

To periodically clear temporarily created files that are no longer required

Why is access control necessary even in a single-user system?

To protect program resources from other applications

What is the primary goal of concurrency control in an OS?

To prevent inconsistent updates and ensure data integrity

What happens when a user tries to delete a file that is currently in use?

The OS causes the attempt to delete the file to fail with an appropriate error code

What is the benefit of accessing a file with the required access level and mode?

It helps to prevent inconsistent updates and ensures data integrity

What is the purpose of marking unused files over a period of time?

To facilitate automatic cleanup of files from specified locations

Why is it necessary to protect critical devices on a system?

To ensure that the devices are used correctly

What happens when a process requests an I/O operation in synchronous I/O?

The I/O operation is started, and control is returned to the user process only when the operation is complete.

What is the main purpose of synchronization in multi-threaded applications?

To prevent race conditions and data corruption.

What is a mutex used for in synchronization?

To implement mutual exclusion.

What is the main difference between a mutex and a semaphore?

A semaphore is a generalized mutex.

What happens when a process requests an I/O operation in asynchronous I/O?

Control is returned immediately to the user process, and the I/O operation continues in the background.

What is the primary cause of race conditions in multi-threaded applications?

Unsynchronized access to shared resources.

What is the purpose of a binary semaphore?

To perform locks to certain critical sections.

What is the result of a race condition in multi-threaded applications?

Unpredictable and potentially corrupted results.

Study Notes

Inter-Process Communication (IPC) and OS

  • The choice of IPC protocols depends on the OS offerings.
  • During development and debug, understanding the OS is necessary to interact with it.
  • Debugging a slowly performing or nonresponsive application requires understanding of OS's input/output operations.

Importance of Knowing the OS

  • Understanding the OS helps in debugging applications.
  • Questions to consider during debug:
    • Are you accessing the file system too often and writing repeatedly to the disk?
    • Is there a garbage collector in place by the software framework/SDK?
    • Is the application holding physical memory information for too long?
    • Is the application frequently creating and swapping pages in memory?
    • What is the average commit size and page swap rate?
    • Is there any other system event that could have affected performance?
    • Is there an impact on the application based on the scheduling policy, application priority, and utilization levels?

Responsibilities of an OS

  • The OS needs to abstract the complexities of the underlying hardware.
  • The OS supports multiple users and facilitates execution of multiple applications at the same time.
  • The OS manages process states: New, Running, Waiting, Ready, and Terminated or Exit.
  • The OS schedules processes on multiple CPU cores, trying to limit context switching between cores.

Process Control Block (PCB)

  • The PCB contains:
    • Process ID (unique identifier)
    • Process state (current state of the process)
    • Pointer (hierarchy of processes)
    • Priority (level of priority)
    • Program counter (current instruction)
    • CPU registers (register details)
    • Memory management info (memory details)
    • I/O status information (I/O details)
    • Accounting information (usage details)

Memory Management

  • Memory-Mapped I/O: allows devices to access memory directly
  • Direct Memory Access (DMA): allows devices to transfer data without involving the CPU

Interrupt Handling Mechanisms

  • Polling or programmed I/O: the OS checks for interrupt information periodically
  • Interrupt-Driven I/O: the OS uses an interrupt vector to handle interrupts

Synchronous vs. Asynchronous I/O

  • Synchronous I/O: the process waits for I/O operation to complete
  • Asynchronous I/O: the process continues while I/O operation is in progress

Synchronization and Critical Sections

  • In multi-threaded applications, access to shared variables needs to be synchronized to avoid race conditions.
  • The OS provides mutexes and semaphores to coordinate access to shared resources.

Mutex and Semaphore

  • Mutex: used for mutual exclusion, allowing only one process to access a resource at a time
  • Semaphore: a generalized mutex, used to coordinate access to shared resources

Concurrency and Cleanup Control

  • The OS ensures that files are not moved or deleted when in use.
  • The OS needs to periodically clean up temporarily created files that are no longer required.
  • The OS uses a garbage collector to mark unused files for deletion.

Access and Protection

  • User Mode and Kernel Mode (Rings): the OS has different levels of access and protection.
  • The OS needs to protect program resources from other applications and critical devices on the system.

Learn about the factors influencing the choice of inter-process communication protocols in different operating systems and how to debug performance issues.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser