TECHNOLOGY 

Published on

KembaraXtra-Computer Science - APIs and System Calls

Key Concepts

System Call:

A mechanism for user-mode code to request services from the kernel mode.

Defines a way for applications to interact with the OS involving kernel intervention.

Operating System API (Application Programming Interface):

Describes a way for applications to interact with the OS, regardless of whether kernel-mode code is invoked.

A broader concept than system calls.

Some API functions will make system calls, while others will not.

Relationship between API and System Calls

APIs are not the same as system calls, but they are related.

System calls are a subset of the functionality exposed by an API.

An API can be implemented using system calls, but it can also provide functionality without directly using them.

Examples

Linux

Linux API (Kernel): Can be seen as a specification for using Linux system calls directly.

Android: Uses the Linux kernel, but has its own higher-level programming interfaces called Android Platform APIs.

Windows

Windows NT Kernel: Provides system calls through the Native API.

Generally not used directly by application developers.

Windows API: Acts as a wrapper around the Native API.

Provides a more user-friendly interface for developers.

Windows API Examples

CreateFileW:

Windows API function that creates or opens a file.

A wrapper around the Native API function NtCreateFile.

Requires a system call because it needs kernel-level access to manage files.

PathFindFileNameW:

Windows API function that extracts a filename from a path.

Does not make a system call.

Can be handled entirely in user mode, requiring only virtual memory access.

Summary

Feature System Call Operating System API
Purpose Request kernel-mode services Provide a programmatic interface to the OS
Scope Kernel mode operations Broader; includes both kernel and user mode operations
Implementation Direct interaction with the kernel Can be implemented with or without system calls
Abstraction Level Low-level Higher-level, often more user-friendly
Picture
0 Comments