How do system calls work?

前端 未结 6 549
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 20:02

I understand that a user can own a process and each process has an address space (which contains valid memory locations, this process can reference). I know that a process can c

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 20:27

    Yes, your understanding absolutely right, a C program can call direct system call, when that system call happens it can be a series of calls till assembly Trap. I think immensely your understanding can help a newbie.Check this code in which I am calling "system" system call.

    #include < stdio.h  >    
    #include < stdlib.h >    
    int main()    
    {    
        printf("Running ps with "system" system call ");    
        system("ps ax");    
        printf("Done.\n");    
        exit(0);    
    }
    

提交回复
热议问题