[Solved] COMP2560 Assignment2- A binary ppm file with 1000 by 1000 pixels

$25

File Name: COMP2560_Assignment2-_A_binary_ppm_file_with_1000_by_1000_pixels.zip
File Size: 602.88 KB

SKU: [Solved] COMP2560 Assignment2- A binary ppm file with 1000 by 1000 pixels Category: Tag:
5/5 - (1 vote)

Write a C program to create a binary ppm file with 1000 by 1000 pixels. It uses five input colors to draw a picture. See sample runs. The input colors can be: red, green, blue, yellow, orange, cyan, magenta, ocean, violet. The corners of the central part should use the 250th and 750th row/column.

Restrictions on the file format:

  • no comment line after the file type specification
  • width (number of columns) and height (number of rows) formatted in ASCII decimal in the second line, separated by a space
  • maximal value of color components given in the third line

Requirements on parallel execution:

  • The original process should write the header information into the image file.
  • Use fork() to create 10 child processes. Each child process can use about 300KB of memory to calculate 100 rows and write the data into the image file.
  • The original process does not work on the pixels. It creates the 10 child processes to do so. To avoid having multiple child processes simultaneously accessing the image file, the parent process simply waits for one child process to terminate before creating the next.

Other requirements:

  • You are not allowed to use standard I/O library functions or graphics related libraries.
  • The command line arguments include the following in order: (i) the name of the image file; (ii) color for center; (iii) color for top-left corner; (iv) color for top-right corner; (v) color for bottom-left corner; (vi) color for bottom-right corner.

Advanced requirements (optional):

  • The numbers of rows and columns of the image are not fixed numbers. They are also command line arguments.
  • The number of child processes is not a fixed number. It is also a command line argument.

Marking scheme:

  • 5 logically clear
  • 5 follow the instructions and correctly use fork() etc.
  • 5 successfully compile
  • 5 pass all tests

60-256 System Programming Dr. Chen

Sample runs:

>>>>> kindergarten drawing.ppm blue green red yellow magenta

>>>>> gimp drawing.ppm

>>>>> kindergarten drawing.ppm orange ocean yellow violet cyan

>>>>> gimp drawing.ppm

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COMP2560 Assignment2- A binary ppm file with 1000 by 1000 pixels
$25