What is the difference between system calls and in

2019-07-23 20:09发布

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条回答
Deceive 欺骗
2楼-- · 2019-07-23 20:42

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.

查看更多
Viruses.
3楼-- · 2019-07-23 20:43

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.

查看更多
聊天终结者
4楼-- · 2019-07-23 20:54

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

查看更多
登录 后发表回答