shared memory

what is shared memory? any one could explain about the shared memory cleary please.............

Replies

  • Reya
    Reya
    In computer programming, shared memory is a method by which program processes can exchange data more quickly than by reading and writing using the regular operating system services. For example, a client process may have data to pass to a server process that the server process is to modify and return to the client. Ordinarily, this would require the client writing to an output file (using the buffers of the operating system) and the server then reading that file as input from the buffers to its own work space. Using a designated area of shared memory, the data can be made directly accessible to both processes without having to use the system services. To put the data in shared memory, the client gets access to shared memory after checking a semaphore value, writes the data, and then resets the semaphore to signal to the server (which periodically checks shared memory for possible input) that data is waiting. In turn, the server process writes data back to the shared memory area, using the semaphore to indicate that data is ready to be read.
  • Morningdot Hablu
    Morningdot Hablu
    praveena211
    the data can be made directly accessible to both processes without having to use the system services.
    You mean to say that during writing and reading data in same computer.We have to check system services.
    praveena211
    the client gets access to shared memory after checking a semaphore value.
    Can you tell me what is semaphore value ??
  • Reya
    Reya
    semaphore is a technique used for coordinating or synchronizing activities in which multiple processes compete for the same operating system resources. A semaphore is a value in a designated place in operating system (or kernel) storage that each process can check and then change. Depending on the value that is found, the process can use the resource or will find that it is already in use and must wait for some period before trying again. Semaphores can be binary (0 or 1) or can have additional values. Typically, a process using semaphores checks the value and then, if it using the resource, changes the value to reflect this so that subsequent semaphore users will know to wait.
    Semaphores are commonly use for two purposes: to share a common memory space and to share access to files. Semaphores are one of the techniques for interprocess communication(IPC)
  • rishi0922
    rishi0922
    semaphore is also used in programming as a variable..

    Semaphore (Programming)
  • rishi0922
    rishi0922
    semaphore is also used in programming as a variable..

    Semaphore (Programming)
  • Morningdot Hablu
    Morningdot Hablu
    @Rishi right rishi semaphore is a variable which is used as a synchronization unit or a flag.
    @praveena thanks for the information..!!
    .
    What about my first question buddy.
    We have to check system services during reading and writing data in the same system ??
  • Reya
    Reya
    yes the user uses the operating system services to read/write the data in the same system.
    some of the operating system services are

    Program execution – system capability to load a program into memory and to run it.
    I/O operations – User programs cannot execute I/O operations directly.So the operating systems by providing I/O makes it convenient for the users to run programs.The user finds the I/O operations has been performed without any details..It is because the operating system hides the user about the hardware details for I/O.User will not be able to control I/O efficiently so the operating system provides this service.
    File-system manipulation – The output of the program need to be written to the file and the input is taken/read from the files.The operating system provides this service to the users.Instead of giving a command to read/write the file and seeks whether his task has been accomplished the operating system makes the user programs to accomplish their tasks very easily..
    Communications – exchange of information between processes executing either on the same computer or on different systems tied together by a network. Implemented via shared memory or message passing.
    Error detection – ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs.
  • ramana_slv
    ramana_slv
    Thank you friends.........

You are reading an archived discussion.

Related Posts

This is thread to discuss the Indo-Aussi Test Series October 2010. -CB
Discuss Medal hopes, Medal won and current status for CWG - 2010 in this thread. -CB
hi, In c whenever dynamic memory allocation functions (eg:malloc) are used ,memory is allocated in heap , but whether this is a virtual memory or secondary memory ? plz reply
hi, In C whenever memory is allocated dynamically (eg:malloc), the memory allocated is heap memory , but is this a virtual memory or secondary memory? plz reply
How can i present a paper in any of the iits..the procedures to be done.can anyone plz help...