When a process enters the CPU, your program must now "fork"and "exe" a stand alone child process. You MUST use "glxgears" for the child process.
When a context switch occurs you still need to put the child back into the ready queue. What we will do is just terminate the child process (glxgears) and put the PCB back on the ready queue. PS Since you are forking the child process you will know its PID, so you can kill the child using the appropriate Linux command via the "system" command.