In modern operating systems, each process has its own address space and one thread of control. However, in practice we often face situations requiring several concurrent tasks within a single process and with access to the same process components: structures, open file descriptors, etc.
Organization of a multi-threading model under any circumstances requires simultaneous access to the same resources. This article provides general information about threads in Windows and Linux OSs, and then presents synchronization mechanisms preventing access to shared resources. For Linux, this article presents the threads interface defined by the POSIX.1-2001 standard (known as “pthreads”).
This article will be of interest for those who deal with applications porting from one system to another or who create multi-threaded applications in one system and want to know how it is practically realized in the other system. This article will also be useful for those who have never programmed applications with multiple threads but plan to do so in the future.
This is a tech article written by Eduard Trunov, Software Engineer at Auriga, Inc.
It was initially published at www.embedded-computing.com.
Feel free to download a PDF version of the article.