What is the difference between system calls and instruction set
Asked Answered
N

3

1

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.

Nisan answered 26/5, 2017 at 12:4 Comment(0)
L
0

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.

Leonaleonanie answered 26/5, 2017 at 12:13 Comment(5)
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 setNisan
You are comparing apples with oranges. System calls are an abstraction provided by the kernelLeonaleonanie
Is there no relation between them? I mean system calls must use the instructions of instruction set to get implemented at he machine levelNisan
The relation is thru a specific machine code instruction like SYSENTER which switches from application code to kernel modeLeonaleonanie
thanks. i think i got a better understanding now, but will have to read about it to get a clear pictureNisan
E
1

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).

Engrossing answered 9/1, 2018 at 2:14 Comment(0)
L
0

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.

Leonaleonanie answered 26/5, 2017 at 12:13 Comment(5)
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 setNisan
You are comparing apples with oranges. System calls are an abstraction provided by the kernelLeonaleonanie
Is there no relation between them? I mean system calls must use the instructions of instruction set to get implemented at he machine levelNisan
The relation is thru a specific machine code instruction like SYSENTER which switches from application code to kernel modeLeonaleonanie
thanks. i think i got a better understanding now, but will have to read about it to get a clear pictureNisan
M
0

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.

Meadow answered 25/1, 2019 at 17:4 Comment(1)
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.Russian

© 2022 - 2024 — McMap. All rights reserved.