Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with some C programming. Most is already done, I just need help figuring out a few functions. Please leave helpful comments in

I need help with some C programming. Most is already done, I just need help figuring out a few functions. Please leave helpful comments in your code so I can fully understand what you did. Thank you!

INSTRUCTIONS:

image text in transcribedimage text in transcribed

Page of 3 ZOOM + FirstLab Use the file Firstlabanswers.docx to answer questions in this lab. . Introduction Lab 1 is a review of C programming and an introduction to Linux processes You have to implement a doubly linked Ist of process structures for process control blocks). You are provided several files to start your program. The files are located on Canvas Files > Labs FirsiLab . proc.h and a skeleton prac.c-this C module maintains a double linked list of process structures, proc.h is fully coded. proc.chas several pre-coded functions, but there are others you must design and implement to get the program running. Split.h and split.c. this C module defines a split function that splits a C string into an array of char pointers, split is similar to the Java String, split function. You should study this code also. split is used in main to process commands and arguments lain.c- is full coded, but it will not work until you have designed and implemented PC.L. nakefile - a simple makefile that can be used to make the program firstLab from the proc modulo, split module, and main.c testx in.txt and tastx out.txt - test cases with inputs and expected output. You can run the test cases using the following $ ./firstLab of 3 ZOOM + 4. Process D has pronty 32 and is the fourth process in the queue A dequeue operation on this queue results Process A, which is the process with priority 4. If you enqueue a process X with priority B, it placed between Process C and Process B. Diagram This assignment is like software maintenance. You have code, which has a problem and your job is to fix the problem. When performing software maintenance, you have to understand the data structures and algorithms of the existing code. A diagram of the data structure can be most helpful. Your program must maintain a priority queue in a double linked list of struct proc data structures. The variable struct prac kernel_procis initialized by the function bootstrap kernel_proc points to an OS kernel process that is priority D. You can think that the process described by *kernel_proc runs when no other process is running. Thus your linked list always has the struct proc that is the kemel process (-kernel proc), and it is the first struct proc in the list. As other procs are created they are inserted after the struct proc pointed to by kernel proc. The following diagram shows a doubly linked list of struct pracs ordered in priority order. Suppose process "Emily" forks a new process named "Coletta" with a priority of 4. The "Coletta" process would be placed between "Emily" and "Gusty". If "Coletta" process had a priority of 10, it would be placed after "Gusty. kernel_proc "kernel proc" pid: 1024 ppid: 1824 priority: RUNNABLE next prev: NULL pid: 1026 ppid: 1025 priority: 3 EMBRYO next -prev: "Gusty" pid: 1025 ppid: 1024 priority: 5 EMBRYO next: NULL -prev: Test Cases Several test cases - Input and expected values are provided. The input test cases use several commands. You should study the input test cases and the nain.c algorithms to see how the commands are processed. fork Gusty 5 kernel_process. This command creates a new process named Custy Gusty has priority 5. Gusty's parent process is the kernel_process. Tork Emily 3 Gusly - This command creates a new process named Emily. Emily has priority 3. Emily's parent process is Gusty. printprocs - This command prints all procs in the list. Sample output is. procs in queue: prene: kernel process, pidi 1824, poid: 1924, priority: , State: RUNNADLE pane: Erily, pid: 1526, paid: 1025, priority: 2, state: EVBIYO 2 Page of 3 ZOOM + FirstLab Use the file Firstlabanswers.docx to answer questions in this lab. . Introduction Lab 1 is a review of C programming and an introduction to Linux processes You have to implement a doubly linked Ist of process structures for process control blocks). You are provided several files to start your program. The files are located on Canvas Files > Labs FirsiLab . proc.h and a skeleton prac.c-this C module maintains a double linked list of process structures, proc.h is fully coded. proc.chas several pre-coded functions, but there are others you must design and implement to get the program running. Split.h and split.c. this C module defines a split function that splits a C string into an array of char pointers, split is similar to the Java String, split function. You should study this code also. split is used in main to process commands and arguments lain.c- is full coded, but it will not work until you have designed and implemented PC.L. nakefile - a simple makefile that can be used to make the program firstLab from the proc modulo, split module, and main.c testx in.txt and tastx out.txt - test cases with inputs and expected output. You can run the test cases using the following $ ./firstLab of 3 ZOOM + 4. Process D has pronty 32 and is the fourth process in the queue A dequeue operation on this queue results Process A, which is the process with priority 4. If you enqueue a process X with priority B, it placed between Process C and Process B. Diagram This assignment is like software maintenance. You have code, which has a problem and your job is to fix the problem. When performing software maintenance, you have to understand the data structures and algorithms of the existing code. A diagram of the data structure can be most helpful. Your program must maintain a priority queue in a double linked list of struct proc data structures. The variable struct prac kernel_procis initialized by the function bootstrap kernel_proc points to an OS kernel process that is priority D. You can think that the process described by *kernel_proc runs when no other process is running. Thus your linked list always has the struct proc that is the kemel process (-kernel proc), and it is the first struct proc in the list. As other procs are created they are inserted after the struct proc pointed to by kernel proc. The following diagram shows a doubly linked list of struct pracs ordered in priority order. Suppose process "Emily" forks a new process named "Coletta" with a priority of 4. The "Coletta" process would be placed between "Emily" and "Gusty". If "Coletta" process had a priority of 10, it would be placed after "Gusty. kernel_proc "kernel proc" pid: 1024 ppid: 1824 priority: RUNNABLE next prev: NULL pid: 1026 ppid: 1025 priority: 3 EMBRYO next -prev: "Gusty" pid: 1025 ppid: 1024 priority: 5 EMBRYO next: NULL -prev: Test Cases Several test cases - Input and expected values are provided. The input test cases use several commands. You should study the input test cases and the nain.c algorithms to see how the commands are processed. fork Gusty 5 kernel_process. This command creates a new process named Custy Gusty has priority 5. Gusty's parent process is the kernel_process. Tork Emily 3 Gusly - This command creates a new process named Emily. Emily has priority 3. Emily's parent process is Gusty. printprocs - This command prints all procs in the list. Sample output is. procs in queue: prene: kernel process, pidi 1824, poid: 1924, priority: , State: RUNNADLE pane: Erily, pid: 1526, paid: 1025, priority: 2, state: EVBIYO 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions