System Calls in Unix and Windows

System calls provide the interface between a process and an operating system. They are available as assembly language instructions and serve as the only mechanism for user programs to access kernel services. System calls are similar to function calls but transfer control from user mode to kernel mode.

How System Calls Work

When a process needs operating system services, it makes a system call which triggers a software interrupt. The CPU switches from user mode to kernel mode, executes the requested service, and returns the result to the calling process. This mechanism ensures security and controlled access to system resources.

System Call Execution Flow User Process System Call Kernel 1. Call 2. Execute 3. Return 4. Resume User Mode Kernel Mode

Unix System Calls

Unix provides around 80 system calls for file system control, process management, and interprocess communication. These system calls are the only way to access the Unix kernel from user programs.

System Call Description
access() Checks if a calling process has access to the required file
chdir() Changes the current directory of the system
chmod() Changes the mode/permissions of a file
chown() Changes the ownership of a particular file
kill() Sends a kill signal to one or more processes
link() Links a new file name to an existing file
open() Opens a file for reading or writing
pause() Suspends execution until a particular signal occurs
stime() Sets the system time
times() Gets the execution times of parent and child processes
alarm() Sets the alarm clock for a process
fork() Creates a new process by duplicating the current process
chroot() Changes the root directory for a process
exit() Terminates the calling process

Windows System Calls

Windows system calls handle file operations, process management, interprocess communication, memory management, I/O devices, and security. The Windows API provides a rich set of system calls that programs use to interact with the operating system.

System Call Description
CreateProcess() Creates a new process and its primary thread
ExitProcess() Terminates the calling process and all its threads
CreateFile() Creates or opens a file, directory, or device
ReadFile() Reads data from a file or device
WriteFile() Writes data to a file or device
CloseHandle() Closes an open object handle
SetTimer() Creates a timer that executes at specified intervals
CreatePipe() Creates an anonymous pipe for interprocess communication
SetFileSecurity() Sets the security descriptor for a file or directory
SetConsoleMode() Sets the input or output mode of a console buffer
ReadConsole() Reads character input from the console input buffer
WriteConsole() Writes characters to the console screen buffer

Comparison

Aspect Unix Windows
Process Creation fork() + exec() CreateProcess()
File Operations open(), read(), write() CreateFile(), ReadFile(), WriteFile()
Process Termination exit() ExitProcess()
IPC pipe(), signal() CreatePipe(), CreateEvent()
Design Philosophy Simple, minimal calls Rich, feature-complete API

Conclusion

System calls are essential for process-OS communication, providing controlled access to kernel services. Unix emphasizes simplicity with around 80 basic calls, while Windows offers a comprehensive API with hundreds of specialized functions. Both approaches effectively bridge user programs and system resources through secure kernel interfaces.

Updated on: 2026-03-17T09:01:38+05:30

27K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements