We’ve been given an assignment to make some modifications to Linux kernel code and recompile it. I’m having hard time figuring out what does this code line do:
p->time_slice = (current->time_slice + 1) >> 1;
To be more exact, why there’s “>> 1” at the end?
“>>” means to shift the value bitwise to the right. “x >> y” is the same as dividing by 2^y and truncating the result. Truncating the result means rounding down in almost all cases, however with negative numbers there may exist alternate implementations. Please see comments if you think this is happening to you.