I want to know the step by step procedure of the below command ... i mean what goes behind the scenes... what i guess is below ... could you please correct it and provide me correct order please....
If i execute a command $ lpr <<file_name>> in a shell.... what i guess was
1). First shell creates process with a same name i.e. by the command name itself(correct me if i was wrong).....
2). If single process is not sufficient to achieve the exact output..then shell itself(correct me if i was wrong) spawns the child processes and calls the wait4() system call until the child process completes successfully... i mean it gets the exit status of the child. ( Correct me if i was wrong)
3). command $lpr <<file_name>>...since the process need to communicate with the printer....and shell is not able to contact with the hardware....because kernel is the only point of contact to the Hardware....(correct me if i was wrong)..
4).Shell tells to kernel via system calls (correct me i was wrong) that please contact the particular printer and prints that file.
5). After that via the system calls kernel contact back to the shell saying that printing action is over....and generates output in shell as printing done successfully(correct me if i was wrong).
I thought those things happened in the background... But in some books i have read that kernel only will manages to create all the processes and manages memory and resources....How i don't know?
Could you please tell me by considering above example...were the shell works and were the kernel works please.....
I am very much interested to learn the behavior of the shell and kernel.