Dining Philosophers Problem (DPP)

Kristi Castro
Updated on 24-Jun-2020 12:16:40

45K+ Views

The dining philosophers problem states that there are 5 philosophers sharing a circular table and they eat and think alternatively. There is a bowl of rice for each of the philosophers and 5 chopsticks. A philosopher needs both their right and left chopstick to eat. A hungry philosopher may only eat if there are both chopsticks available.Otherwise a philosopher puts down their chopstick and begin thinking again.The dining philosopher is a classic synchronization problem as it demonstrates a large class of concurrency control problems.Solution of Dining Philosophers ProblemA solution of the Dining Philosophers Problem is to use a semaphore to ... Read More

Execute Script on Playback Rate Change in HTML

vanithasree
Updated on 24-Jun-2020 12:15:10

139 Views

Use the onratechange attribute to execute a script each time the playback rate changes in HTML in HTML.ExampleYou can try to run the following code to implement onratechange attribute − Live Demo                                        Your browser does not support the video element.             Change the speed of the video                      function display() {             document.getElementById("test").innerHTML = "Speed: " + document.getElementById("myid").playbackRate;          }          function update(ob) {             document.getElementById("myid").playbackRate = ob.value;          }           Output

Process vs Parent Process vs Child Process

Ricky Barnes
Updated on 24-Jun-2020 12:11:24

10K+ Views

In Operating System, the fork() system call is used by a process to create another process. The process that used the fork() system call is the parent process and process consequently created is known as the child process.Details about these are given as follows −ProcessA process is an active program i.e a program that is under execution. It is more than the program code as it includes the program counter, process stack, registers, program code etc. Compared to this, the program code is only the text section.A process changes its state as it executes. This state partially depends on the ... Read More

Cooperating Process

Ricky Barnes
Updated on 24-Jun-2020 12:08:59

10K+ Views

Cooperating processes are those that can affect or are affected by other processes running on the system. Cooperating processes may share data with each other.Reasons for needing cooperating processesThere may be many reasons for the requirement of cooperating processes. Some of these are given as follows −ModularityModularity involves dividing complicated tasks into smaller subtasks. These subtasks can completed by different cooperating processes. This leads to faster and more efficient completion of the required tasks.Information SharingSharing of information between multiple processes can be accomplished using cooperating processes. This may include access to the same files. A mechanism is required so that ... Read More

Methods for Handling Deadlocks

Kristi Castro
Updated on 24-Jun-2020 12:06:06

17K+ Views

Deadlock detection, deadlock prevention and deadlock avoidance are the main methods for handling deadlocks. Details about these are given as follows −Deadlock DetectionDeadlock can be detected by the resource scheduler as it keeps track of all the resources that are allocated to different processes. After a deadlock is detected, it can be handed using the given methods −All the processes that are involved in the deadlock are terminated. This approach is not that useful as all the progress made by the processes is destroyed.Resources can be preempted from some processes and given to others until the deadlock situation is resolved.Deadlock ... Read More

Set the Width of the Element in HTML

Sravani S
Updated on 24-Jun-2020 12:04:06

296 Views

Use the width attribute in HTML to set the width of an element. You can use the attribute with the following elements − , , , , , etc.ExampleYou can try to run the following code to implement width attribute in HTML − Live Demo                                        Your browser does not support the video element.           Output

Mutex vs Semaphore

Ricky Barnes
Updated on 24-Jun-2020 12:01:12

29K+ Views

Mutex and Semaphore both provide synchronization services but they are not the same. Details about both Mutex and Semaphore are given below −MutexMutex is a mutual exclusion object that synchronizes access to a resource. It is created with a unique name at the start of a program. The Mutex is a locking mechanism that makes sure only one thread can acquire the Mutex at a time and enter the critical section. This thread only releases the Mutex when it exits the critical section.This is shown with the help of the following example −wait (mutex); ….. Critical Section ….. signal (mutex);A ... Read More

Multi-Threading Models

Alex Onsman
Updated on 24-Jun-2020 12:00:25

22K+ Views

Multithreading allows the execution of multiple parts of a program at the same time. These parts are known as threads and are lightweight processes available within the process. Therefore, multithreading leads to maximum utilization of the CPU by multitasking.The main models for multithreading are one to one model, many to one model and many to many model. Details about these are given as follows −One to One ModelThe one to one model maps each of the user threads to a kernel thread. This means that many threads can run in parallel on multiprocessors and other threads can run when one ... Read More

Monitors vs Semaphores

David Meador
Updated on 24-Jun-2020 11:59:09

4K+ Views

Monitors and semaphores are used for process synchronization and allow processes to access the shared resources using mutual exclusion. However, monitors and semaphores contain many differences. Details about both of these are given as follows −MonitorsMonitors are a synchronization construct that were created to overcome the problems caused by semaphores such as timing errors.Monitors are abstract data types and contain shared data variables and procedures. The shared data variables cannot be directly accessed by a process and procedures are required to allow a single process to access the shared data variables at a time.This is demonstrated as follows:monitor monitorName { ... Read More

Message Passing vs Shared Memory Process Communication Models

Alex Onsman
Updated on 24-Jun-2020 11:56:48

4K+ Views

Message passing model and shared memory model are models of interprocess communication. Details about these are given as follows −Message Passing Process Communication ModelMessage passing model allows multiple processes to read and write data to the message queue without being connected to each other. Messages are stored on the queue until their recipient retrieves them. Message queues are quite useful for interprocess communication and are used by most operating systems.A diagram that demonstrates message passing model of process communication is given as follows −In the above diagram, both the processes P1 and P2 can access the message queue and store ... Read More

Advertisements