5

I want to have clarity on user space program and OS interaction. In the context of a file I/O, I want to know how a user app like a java file i/o API read() may work. Since file operations are accessed by POSIX system calls like open() close() read() write(), how does the java code calls these system calls ?

When we compile the java code, what kind of instructions the java read() API would be compiled to ? Its said, user programs raise traps/software interrupts to make system calls. So does Java read() API is also raise traps ? Are there APIs in java to Raise traps ? If yes, so those APIs might be compiled to trap instructions like 'INT' ? But then does INT calls higher layer POSIX system calls or some fixed ISRs (Interrupt Service Routines) ?

I am confused and trying to know step by step... from compilation to execution- how system calls are done in this scenario.

Please help me with this simple concept.

sapthrishi007
  • 393
  • 3
  • 13

2 Answers2

0

Perhaps I got a very good clarification on http://pages.cs.wisc.edu/~remzi/OSFEP/intro-syscall.pdf
Hence I enfer the following flow: Java Code -> JNI -> read() syscall in C -> kernel subroutines. But last doubt: How JNI which is in Java, calls C codes ?

sapthrishi007
  • 393
  • 3
  • 13
0

The answer to this question is java run time environment.It provide a system call interface which intercepts java function call in the api and invokes the necessary system call

master
  • 1