Question: Implement a prototype list of process control block (PCB) in C language. Please follow the specifications below: Must use the headers given in the next

Implement a prototype list of process control block (PCB) in C language. Please follow the specifications below:

  • Must use the headers given in the next page. All you need has been given.

  • Must use malloc and sizeof to create new PCBs.

  • Must create and put 12 processes into the PCB list.

  • Your code must show the following information for each process.

Your complete C program should be no more than 120 lines (Excluding the headers in the next page)

Here is the example:

index of process: 7

addr_pcb = 400031c8

proc_id = 2

proc_class = 2

proc_priority = 2

proc_state = 0

Header file:

struct saved_regs{

double reg1,reg2,reg32,reg_pc;

};

struct pcb_type{

int proc_id;

int proc_priority;

int proc_state;

int proc_class;

struct saved_regs *reg_pt;

};

struct process_list{

struct pcb_type *pcb_pt;

struct process_list *who_follows;

};

struct process_list *start = NULL;

int allocated_id = 1;

int allocated_prio = 1;

int allocated_class = 1;

struct saved_regs *alloc_saved_regs ();

struct pcb_type *create_new_pcb ();

void add_new_process (struct pcb_type *);

Basically, build a C program that will create 12 mock processes, attach them to 'start' (in the header file), and prints this for each of the 12 processes:

Here is the example:

index of process: 7

addr_pcb = 400031c8

proc_id = 2

proc_class = 2

proc_priority = 2

proc_state = 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!