Helping ordinary people create extraordinary websites!

Port Windows IPC Apps to Linux, Part 1: Processes and Threads

By Srinivasan S. Muthuswamy, Kavitha Varadarajan
2005-06-16

Processes

Basic execution units in Windows and Linux are different. In Windows, the thread is the basic execution unit, and the process is a container that holds this thread.

In Linux, the basic execution unit is the process. The functionalities offered by Windows APIs can be mapped directly to Linux system calls:

Table 1. Process mapping

WindowsLinuxClassification
CreateProcess()
CreateProcessAsUser()
fork()
setuid()
exec()
Mappable
TerminateProcess()kill()Mappable
SetThreadpriority()
GetThreadPriority()
Setpriority()
getPriority()
Mappable
GetCurrentProcessID()getpid()Mappable
Exitprocess()exit()Mappable
Waitforsingleobject()
Waitformultipleobject()
GetExitCodeProcess()
waitpid()
Using Sys V semaphores, Waitforsingleobject/multipleobject
can be implemented
Context specific
GetEnvironmentVariable
SetEnvironmentVariable
getenv()
setenv()
Mappable

The Classification column (which explains classification constructs used in this article) indicates whether the Windows construct is mappable or context specific:

  • If mappable, the Windows construct can be mapped to the specified Linux construct(s) by closely examining the types, parameters, return codes, and such. Both the Windows and Linux constructs provide similar functionality.
  • If context specific, the given Windows construct may or may not have an equivalent construct in Linux, or Linux may have more than one construct that provides similar functionality. In either case, the decision to use a specific Linux construct(s) depends on the application context.




Tutorial pages:

First published by IBM DeveloperWorks


 3 Votes

You might also want to check these out:


Leave a Comment on "Port Windows IPC Apps to Linux, Part 1: Processes and Threads"
You must be logged in to post a comment.

Link to This Tutorial Page!


GET OUR NEWSLETTERS