2
$\begingroup$

Lately, I have been reading about operating systems design. The idea that all user space programs utilize Kernel services via a "System Call Interface" have got me thinking further into this.

Is system call implemented in specific language like C/C++ on each operating system or it is some sort of assembly language or machine code?

$\endgroup$
  • 2
    $\begingroup$ This is rather broad: some of your sub-questions should probably be questions in their own right. It also seems to be based on something of a misunderstanding. "Assembly language" is just a CPU-specific programming language so system calls aren't "in assembly language." $\endgroup$ – David Richerby Mar 21 '16 at 2:43
  • 2
    $\begingroup$ Welcome to CS.SE! We want you to ask only one question to per post, so I've edited your question to focus on only the first one. You can ask the others separately (see the revision history to see the original version of your post; click on "edited..." under the question). That said, as it stands right now this question could use some improvement. What are your thoughts? What reading have you done? It looks like you might have a misconception, but it's hard to diagnose exactly what is the problem without knowing more about your current understanding. Can you edit the question? $\endgroup$ – D.W. Mar 21 '16 at 3:11
  • $\begingroup$ This strikes me as a question about conventions of implementing OSs, not a conceptual computer science question. Community votes, please; is this offtopic? $\endgroup$ – Raphael Mar 21 '16 at 9:33
2
$\begingroup$

System calls are usually implemented in C (or at least that used to be the case) mixed with assembly language. That said, everything gets translated eventually to machine code.

$\endgroup$
2
$\begingroup$

Looking at the linux source code here it would appear that they implement the bulk of it in C with some macros to call some some small amount of assembly code needed to set interrupts and a few other things. I'm not sure exactly how they are setting the interrupts but it would appear that a minimal of the work is done in assembly. Even much of the architecture specific stuff is done in C as seen here. I can't imagine working at that level of complexity outside of a higher level language frankly either.

Not that my experience means anything but this is also how we did things when I took my operating systems class but frankly that's not telling of how a state of the art OS does things. Linux is a much better source of information.

So it looks like things are mostly done in C with a bare minimum done in assembly.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.