Iam confused whether system calls and instruction set are synonymous? Do the instructions like MOV, LOAD, CALL, IN, OUT , ADD, SUB etc fall in the category of system calls? System call instructions like open(), close(), read(), write(). If not then what is the relationship between them. Can someone please explain and clear the confusion.
3 Answers
The functions we call from User space into the Kernel is call System calls.
An instruction set is a group of commands in machine code that can be recognized and executed by a CPU(Central Processing Unit).

- 72,055
- 26
- 237
- 180
Several books are needed to explain the difference. I recommend notably Operating Systems : Three Easy Pieces and some book on computer architecture, or at least some slides on the fictitious Y86 instruction set.
An instruction set architecture defines the machine code understood by some processor and how every machine instruction changes the (observable) state of the computer (e.g. changes content of processor registers -including the program counter and the call stack pointer, memory locations in virtual address space, etc...)
A system call is done by some application program to request services from the operating system kernel. From the application program's point of view, that is often an elementary machine instruction (e.g. SYSENTER
or SYSCALL
) but the kernel will run a big lot of code (inside the kernel) before returning to the application program.
In other words, an operating system kernel provides the application process the illusion that the processor understands ordinary unprivileged machine code augmented by a system-call primitive (able to run any of the syscalls provided by the kernel; for Linux see syscalls(2) for an exhaustive list). Read also about SYSENTER
in Linux and SYSENTER
on OsDev.
The point is that with various CPU modes some privileged machine instructions (e.g. those accessing peripherals or the MMU) are only permitted to the kernel. If your application code tries them, the processor would raise some exception.

- 223,805
- 18
- 296
- 547
-
Do the system calls get converted to the instructions provided by instruction set? Or can i say that system calls are a layer above instruction set – Pranjal Kanyal May 26 '17 at 12:20
-
You are comparing apples with oranges. System calls are an abstraction provided by the kernel – Basile Starynkevitch May 26 '17 at 12:24
-
Is there no relation between them? I mean system calls must use the instructions of instruction set to get implemented at he machine level – Pranjal Kanyal May 26 '17 at 12:28
-
The relation is thru a specific machine code instruction like `SYSENTER` which switches from application code to kernel mode – Basile Starynkevitch May 26 '17 at 12:28
-
thanks. i think i got a better understanding now, but will have to read about it to get a clear picture – Pranjal Kanyal May 26 '17 at 12:35
Instruction:- It is always given to perform individual task.
System call:- It is a set of instruction all together called by a single name identifiable by the system is called as a system call.
-
In general, at the physical level the instruction can be translated into some **microcode**. at the logical level in both cases we are talking about individual tasks. Your definition seems inaccurate. – Dmytro Dadyka Jan 25 '19 at 17:26