Question: how to calculate sjf in os?
Answer: There are basically two types of SJF methods:
Step 0) At time=0, P4 arrives and starts execution.
Step 1) At time= 1, Process P3 arrives. ... 
Step 2) At time =2, process P1 arrives and is added to the waiting queue. ... 
Step 3) At time = 3, process P4 will finish its execution.