Skip to content

Concurrency

Statement

Solution

  • I tried to signup for TechRepublic but it failed, and the search did not work.
  • I also signed up for LightReading but the search did not return any relevant information.
  • The BitPipe interface was not friendly and I did not know how to move around.
  • The last thing was SANS which did return some results but they are irrelevant and I did not understand to deal with these websites.
  • Anyhow, I can talk about concurrency within the scope of this week’s reading.
  • Concurrency means running processes (or threads) in parallel; it is an easy topic if the hardware supports it and the two running tasks are completely separate and do not interact with each other.
  • however, threads within the same process can run in parallel since they share the same heap and each of them has its own stack space.
  • The part of the code that is shared between threads is called the critical section.
  • A mechanism should be put in place to only allow one thread at a time to access and modify the critical sections of the code.
  • The mechanisms may include:
    • Locks: C language provides POSIX complaint lock objects that can be used to safely manage threads’ access to a critical section.
    • Signals: A similar mechanism to the locks can be implemented using C lang helpers, or manually implementing these conditional variables.
  • In both mechanisms, when a thread is trying to access a critical section that’s locked; the thread must keep waiting until the other thread had released this critical section.

References