1. Homepage
  2. Programming
  3. System Programming (Section 3174, 3176) Project #1: Find the minimum number using multi-process

System Programming (Section 3174, 3176) Project #1: Find the minimum number using multi-process

Engage in a Conversation
System ProgrammingFind the minimum number using multi-processCMultiple ProcessInter-Process CommunicationIPCShared Memory

System Programming (Section 3174, 3176)

Project #1 Find the minimum number using multi-process CourseNana.COM

Project Objective

  • Students can write a Makefile to compile the source codes for their program.
  • Students can make a program using system calls related to multi-process, signals, and IPC (Inter-Process Communication).

Project Description

The main goal of this project is to find a minimum value of given integer arrays using multi-process. Please implement details of the functions in the proj1.c. You can find the functions as they mark with the comment “FIX ME”. Also, please implement the main function in the main.c file. You may follow the comments that explain what you implement. CourseNana.COM

  1. The provided skeleton codes are written in C. You have to submit one Makefile and two source codes written in C (proj1.c, main.c). Please do not modify the proj1.h file. I will not consider the changes in proj1.h file.

    1. Write a Makefile

    Please write a Makefile script to compile the provided sourcde code. Your Makefile must satisfy the following conditions: 1) If you type make in the shell, your source codes have to be compiled. CourseNana.COM

    • The name of the binary file should be proj1
    • The compiler is gcc 2) If you type make clean, the object file (*.o) and the binary file (proj) should be removed from your working directory.

      2. Write a program

      1) The following information is provided by the arguments of the program that the user input. CourseNana.COM

    • 1st argument : Number of inputs (number of integers)
    • 2nd argument : Number of processes. 2) Create a shared memory, and the parent process first creates a random integer array that the number of an element is equal to the number of inputs (1st argument of the program). Please use the generate_input function to create an integer array. Also, please implement details of the following function

- Function that you have to implement: sets_shared_memory() 3) Create child processes. The number of child processes should be equal to the second argument of the program. The process ids of the child processes are stored in the array of process ids. Please refer to the following example: CourseNana.COM

  • pid_t pid_arr = malloc(sizeof(pid_t)n_process); 4) The parent process should be paused after creating all child processes. The lastly created child process sends a process to the parent process to resume the parent process. 5) The parent process sends the signals to the child processes to resume the child processes. 6) The integer array is divided into chunks that have the same size. Each chunk will be assigned to each child process. Each child process should find the minimum value of the given chunk. Please implement the details of the following function
  • Function that you have to implement: child_find_min_value() 7) The child process stores the minimum value in the shared memory region. As you know, the original integer array is stored in the shared memory region, so the value should be stored after the array. The minimum values in shared memory should be sorted by the id of the child process. Please implement the details of the following function
  • Function that you have to implement: put_value() 8) The parent process waits for the child processes to reap. After that, traverse the minimum values that the child processes stored. And the parent process finds the minimum values. 9) The parent process prints the minimum value. After that, the parent process unlinks the shared memory region.

    3. Tips

  • Do not add the new function to the proj1.h file. You can modify the value of BILLION macro to test your code.
  • Do not modify the arguments of the functions in proj1.c
  • Do not make your code publicly available. It makes your score for this project 0.
  • Please add –lrt flag to compile your source code. Example) gcc –o hello a.o b.o –lrt
  • In WSL, POSIX shared memory is highly recommended.
  • To pause the process, use the pause system call().

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
System Programming代写,Find the minimum number using multi-process代写,C代写,Multiple Process代写,Inter-Process Communication代写,IPC代写,Shared Memory代写,System Programming代编,Find the minimum number using multi-process代编,C代编,Multiple Process代编,Inter-Process Communication代编,IPC代编,Shared Memory代编,System Programming代考,Find the minimum number using multi-process代考,C代考,Multiple Process代考,Inter-Process Communication代考,IPC代考,Shared Memory代考,System Programminghelp,Find the minimum number using multi-processhelp,Chelp,Multiple Processhelp,Inter-Process Communicationhelp,IPChelp,Shared Memoryhelp,System Programming作业代写,Find the minimum number using multi-process作业代写,C作业代写,Multiple Process作业代写,Inter-Process Communication作业代写,IPC作业代写,Shared Memory作业代写,System Programming编程代写,Find the minimum number using multi-process编程代写,C编程代写,Multiple Process编程代写,Inter-Process Communication编程代写,IPC编程代写,Shared Memory编程代写,System Programmingprogramming help,Find the minimum number using multi-processprogramming help,Cprogramming help,Multiple Processprogramming help,Inter-Process Communicationprogramming help,IPCprogramming help,Shared Memoryprogramming help,System Programmingassignment help,Find the minimum number using multi-processassignment help,Cassignment help,Multiple Processassignment help,Inter-Process Communicationassignment help,IPCassignment help,Shared Memoryassignment help,System Programmingsolution,Find the minimum number using multi-processsolution,Csolution,Multiple Processsolution,Inter-Process Communicationsolution,IPCsolution,Shared Memorysolution,