Question: IN C PLEASE Question #2: Implementing print-num-cores() [20 pts] We now implement the print_num cores () function, which is called to print the number of
IN C PLEASE
![IN C PLEASE Question #2: Implementing print-num-cores() [20 pts] We now implement](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66d5e8e873961_82366d5e8e7f091d.jpg)
Question #2: Implementing print-num-cores() [20 pts] We now implement the print_num cores () function, which is called to print the number of cores available on the machine. Here is an example interaction: 1. See the kernel release 2. See the number of cores 3. See the RAM capacity 4. Exit user types '2" 4 The above means that there are 4 cores on the machine. This number is obtained by counting the number of lines in file /proc/cpuinfo that contain the string "processor". Hints: The main idea is to call grep and pass its output to we (with the command-line argument that only prints lin count; read the man page) This is a typical example for which using popen is key As seen in the lecture note examples, you'll also need to use dup and fileno
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
