Ask or Answer

🏠 Home🏷️ Tags❔ Ask a Question✔️ Answer a QuestionUsers
646 views

Please log in or register to answer this question.

1 Answer

Answer :

Shared memory :

For sharing of data faster and communication between programs, we use shared memory. Shared memory can be used with multiprocessors and single processors. Means Program can be run on the single processor and multiple processors the memory used for communication between threads of the program is called shared memory. In the shared memory system, the single processor has the access to the same memory and also if there are multiple processors they also have the access to same memory. If the applications are developed for shared memory they can share data by using same memory location. Shared memory is the method of Inter-Process Communication (IPC). Shared memory is faster than message queue.

Shared memory has two types:

1.Uniform memory access

2.Non-uniform memory access

The shared data should be protected otherwise it will cause shared data problems.


Mutex:

The mutex is the key to the shared resource. The mutex is the program object which is used for sharing the same resource among multiple program thread. The shared resource cannot be used by multiple threads so for locking the shared resource we use the mutex. If the shared resource is lock by mutex then the thread will go into the queue and when the shared resource is unlocked by mutex then the shared resource is used by another thread. Mutex provide mutual exclusion. A mutex does not allow the access to shared resource simultaneously.

There are two basic operations of mutex:

1. LOCK(mutex)

2. UNLOCK(mutex)

The mutex lock the shared resource when it is used by the thread and unlock the shared resource when the task finishes.


Message passing:

Message passing is the method of interprocess communication (IPC). Message passing is slower than shared memory. Message passing is used in parallel programming and object orientated programming. Message passing can be synchronous or message passing can be asynchronous.

Deadlock:

Deadlock is a problem where threads or processes are in waiting state and waiting for each other to unlock or to release the shared resource. Means thread is waiting for the next thread to unlock while the next thread is waiting for the first thread to unlock for execution, So both stops progressing execution and result in deadlock process. By rebooting or resetting the entire system we can end the deadlock.

Deadlock may be caused due to:

1. Mutual exclusion

2. Hold and wait

3. No resource preemption

4. Circular wait

If the four conditions occur simultaneously then the deadlock occurs.

Like 0 like

Related Questions

141 views

Description : Explain the advantages and disadvantages of using memory I/O and standard I/O.

Last Answer : Memory mapped I/O and standard I/O are the two methods for communicating microprocessor with peripherals. Processor talks to both memory and peripheral using the same bus.Two ways to talk to a peripheral. ... of standard I/O is no loss of memory addresses to the use as I/O addresses.

1 answer
110 views

Description : Explain memory hierarchy.

Last Answer : Memory hierarchy: Main memory is large, inexpensive, slow memory stores entire program and data. Cache memory is small, expensive, fast memory stores copy of likely accessed parts of large ... In memory hierarchy the smaller memory is faster and larger memory storage is slower.

1 answer
3,380 views

Description : Explain memory write ability and storage permanence with suitable diagram.

Last Answer : Write ability and storage permanence of memories: Write ability is the manner and speed at which memory can be written. Storage permanence is the ability of memory to hold stored bits ... Holds bits after power is no longer supplied. High end and middle range of storage permanence.

1 answer
381 views

Description : EEPROM VS FLASH MEMORY

Last Answer : EEPROM VS FLASH MEMORY

1 answer
136 views

Last Answer : EPROM EEPROM Flash EPROM Normalize cell size is 1. Normalize cell size is about 1 ... and floating gate, which is insulated by a dielectric material. NAND flash memory and NOR flash memory are the two types of flash memory.

1 answer
Show MoreAsk QuestionNext Page →