Skip to main content

Command Palette

Search for a command to run...

Day 20/100 100 Days of Code

Learning

Updated
1 min read
Day 20/100 100 Days of Code
C

AKA Chris, is a software developer from Athens, Greece. He started programming with basic when he was very young. He lost interest in programming during school years but after an unsuccessful career in audio, he decided focus on what he really loves which is technology.

He loves working with older languages like C and wants to start programming electronics and microcontrollers because he wants to get into embedded systems programming.

I spent the session watching more tutorials on concurrency. I watched the whole playlist and I learned how both Mutex and BinarySemaphore can be used and where to use them. I learned about the std::jthread object which can be used to automate the join operation and the std::jthread::request_stop to stop any running threads.

What is the difference between Mutex and Semaphore

  1. Allows only one thread to go through a critical section

  2. A section is locked or unlocked

  3. It pretty much is a locking mechanism

Semaphore

  1. Multiple threads can be used at the same time

  2. It depends on the counter

  3. It is a signaling mechanism

When to use Mutex and when to use Semaphore

To run a single operation on multiple threads, use Mutex. To run multiple operations at the same time synchronized, use Semaphore as signaling can be used to make a thread start doing its operation or wait for a signal to start.

100 Days of Code

Part 20 of 50

100 days of code is a good initiative to go into hard mode and spend more time in programming. These 100 days will be focused on completing projects and research.

Up next

Day 21/100 100 Days of Code

Info Hunter