Thread: Concurrency in c

  1. #1
    Registered User
    Join Date
    Nov 2019

    Concurrency in c

    Hi , im trying to do scheduling between two process/threads that I have one shared memory , one process is writing and other process is reading, I have function void write , and function void read ; so what I need to do is to synchronize between two process in order to not having deleted data or any concurrency OS issues,
    what I have did is to do global flag variable called Enable, int Enable =0 ; and say if Enable ==0 then just -write function - can write , other wise Enable=1 then just - Read function - can work ; but I didn't find that technique is a good solution for synchronize between two threads. could anyone tell me any suggestion how could I synchronize between two threads? or any suggestion with my flag synchronize between two threads/processes? thanks alot

    By the way I must not use mutex/semaphore on that question , all what I need is to do synchronize between two threads on one shared memory, one is reading and the other is writting.

    thanks for helping me guys.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is It Worth Detecting Concurrency?
    By SMurf in forum Tech Board
    Replies: 1
    Last Post: 08-28-2012, 04:20 PM
  2. Maximum concurrency
    By CornedBee in forum Linux Programming
    Replies: 15
    Last Post: 11-23-2007, 06:55 AM
  3. waitable boolean class (concurrency)
    By underthesun in forum C++ Programming
    Replies: 11
    Last Post: 11-12-2007, 11:36 AM
  4. Concurrency documentation
    By subdene in forum A Brief History of
    Replies: 7
    Last Post: 02-16-2005, 11:14 AM
  5. concurrency?
    By unregistered in forum C Programming
    Replies: 3
    Last Post: 05-25-2002, 02:11 AM

Tags for this Thread