context switch during doubly linked list creation
There's an example in Maurice Bach's The Design of the Unix Operating System that mentions how it's possible for a doubly linked list to be destroyed due to a context switch during its creation. (He goes on to say that this is prevented by raising the processor level during such critical regions of code, but I'm having trouble understanding his reasoning that tries to show the problem in the first place) The sample code that he includes is as follows: struct queue { } *bp, *bp1; bp1 -> forp = bp -> forp; bp1 -> backp = bp; bp -> forp = bp1; /* consider possible context switch here */ bp1 ->