79809625

Date: 2025-11-05 05:00:38
Score: 1
Natty:
Report link

When we look in terms of the software interrupt like needing Hardware, Then these Interrupts will come into picture. Suppose if we want to print the value on the screen(written in c program) , The CPU will stop it's execution and that interrupt will be serviced first. It will leads to call the system call. System call is a special type of function which is going to be in the OS code. This function can't be accessed by the user without the system call. Compiler will converts the given c code to assembly code. So when ever you write the "printf("hello")", In the assembly code it will be 'rax 50,syscall' ,where rax is a register. Once syscall is instruction seen by the cpu ,it'll go to the rax register and finds the appropirate number for that syscall as there 400+ system calls in the OS. Now cpu will go to the system call table(Interrupt vector table) and finds the address of that 50. Address of that 50 is function pointer sys_write. It is also takes arguments "hello" inorder to print on the screen and cpu will execute the code of the function sys_write in the kernel mode(OS) which is to be INTERRUPT SERVICE ROUTINE. Once that interrupt service routine is done with the help of function pointer then cpu will get back to the user mode.

For the fun(), fun is pointer to that function.

50 sys_write.
51 fork.
Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Starts with a question (0.5): When we
  • Low reputation (1):
Posted by: murali dileep