shared memory

ramana_slv

ramana_slv

@ramana-slv-xx4JdA Oct 23, 2024
what is shared memory? any one could explain about the shared memory cleary please.............

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Reya

    Reya

    @reya-SMihdC Sep 28, 2010

    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

    @morningdot-6Xuj4M Sep 28, 2010

    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

    @reya-SMihdC Sep 28, 2010

    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

    @rishi0922-a2xTAa Sep 28, 2010

    semaphore is also used in programming as a variable..

    <a href="https://en.wikipedia.org/wiki/Semaphore_(programming)" target="_blank" rel="nofollow noopener noreferrer">Semaphore (Programming)</a>
  • rishi0922

    rishi0922

    @rishi0922-a2xTAa Sep 28, 2010

    semaphore is also used in programming as a variable..

    <a href="https://en.wikipedia.org/wiki/Semaphore_(programming)" target="_blank" rel="nofollow noopener noreferrer">Semaphore (Programming)</a>
  • Morningdot Hablu

    Morningdot Hablu

    @morningdot-6Xuj4M Sep 28, 2010

    @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

    @reya-SMihdC Sep 29, 2010

    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

    @ramana-slv-xx4JdA Sep 29, 2010

    Thank you friends.........