Computer Science, asked by Shalini1037, 9 months ago

21. You are asked to design and implement a new synchronization primitive that will allow multiple processes to block on an event until some other process signals the event. When a process signals the event, all processes that are blocked on the event are unblocked. If no processes are blocked on an event when it is signaled, then the signal has no effect. Implement the following using C functions.
• intdoeventopen(); Creates a new event, returning event ID on success, -1 on failure.
• intdoeventclose(inteventID); Destroy the event with the given event ID and signal any processes waiting on the event to leave the event. Return number of processes signaled on success and -1 on failure.
• intdoeventwait(inteventID); Blocks process until the event is signaled. Return 1 on success and -1 on failure.
• intdoeventsig(inteventID); Unblocks all waiting processes; ignored if no processes are blocked. Return number of processes signaled on success and -1 on failure.

Answers

Answered by ıtʑFᴇᴇʟɓᴇãᴛ
0

Tex

html

head

process signals the event. When a process signals the event, all processes that are blocked on the event are unblocked. If no processes are blocked on an event when it is signaled, then the signal has no effect. Implement the following using C functions.

• intdoeventopen(); Creates a new event, returning event ID on success, -1 on failure.

• intdoeventclose(inteventID); Destroy the event with the given event ID and signal any processes waiting on the event to leave the event. Return number of processes signaled on success and -1 on failure.

• intdoeventwait(inteventID); Blocks process until the event is signaled. Return 1 on success and -1 on failure.

• intdoeventsig(inteventID); Unblocks all waiting processes; ignored if no processes are blocked. Return number of processes signaled on success and -1 on failure.

Similar questions