






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







set_signal_handler ((void) (*new_handler) (int));
typedef struct { lock_t lock_1; lock_t lock_2; int A; int B; } score_t;
void normalize (score_t* s) {
if (s->A < s->B) { s->A = 0; s->B = s->B – s->A; } else { s->B = 0; s->A = s->A – s->B; }
void A_scores (score_t* s) {
s->A = s->A + 1;
void handicap (score_t* s) {
if (s->A < s->B) { s->A = s->A + 2; } else { s->B = s->B + 2; }
void B_scores (score_t* s) {
s->B = s->B + 1;
/* statically allocated file descriptor table with up to 1,024 entries / typedef struct { file elt[1024]; } file_table_t;
task structure includes pointer to file descriptor table and lock to synchronize changes to the table / typedef struct { / (lots of other stuff omitted) / lock_t file_lock; / lock to protect file descriptor table / file_table_t files; /* pointer to file descriptor table / / (possibly shared) */ } task_t;
typedef struct { jmp_buf jb; /* jump buffer for setjmp/longjmp / int rval; / return value for longjmp */ } my_jmp_buf;
int my_setjmp (my_jmpbuf* env, int val) { env->rval = val; setjmp (env->jb); }
void my_longjmp (my_jmpbuf* env) { longjmp (env->jb, env->rval); }
/* call this function once your function finds the swap block number */ extern void load_swap_block (u32 virt_addr, u32 block_num);