context system call in truss

133 views Asked by At

While taking the truss of a process in Solaris 10, I found the below statement

<pid>/2:    70.7602 context(1, 0xFC47ABF8)

Please explain what this system call context means Also after this call I saw thread 2 behaving like another thread 4.

1

There are 1 answers

0
jim mcnamara On
<ucontext.h>
int getcontext(ucontext_t *ucp);
int setcontext(const ucontext_t *ucp);`

These two calls save and restore a context in Solaris. I do not know positively, as there is no explicit mention of context() in McDougal And Mauro 'Solaris Internals'. I assume context() is the actual kernel call that corresponds these api entry points. Perhaps context(1, <addr> ) corresponds to getcontext(), I do not know.

Context switching is how an OS allows a given process to use system resources for a given quantum (time slice). Part of scheduling.