I am confused by the function of spin lock.
The spin lock is used to stop the process from re-scheduling. However, in a machine with just one core, is it useful to use s
No.
For a much more detailed answer, see "How Do Locks Lock?" along with the comments.