Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

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:
» A mapping guide for complex, multithreaded, multiprocess applications
» Processes
» Creating a process
» Terminating a process
» Using wait functions
» Exiting a process
» Environment variables
» Examples
» Threads
» Examples of processes and threads
» Next in the series
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» How to Install PHP 5 on Linux
» How to Install Apache 2 on Linux
» How to Install MySQL 5.0 on Linux
» SMB Caching
» Mound --Bind
» Tar Wild Card Interpretation

Ask A Question
characters left.