OS – hw2solution

$30.00 $24.00

Multi-Threading Programming Example – Hello Thread! hello_thread.c Output vvvvvvvvdddv x <pthread.h> library info Ref: Tools for showing threads • NCTU Workstation > top (THR means the num of threads under the process) Tools for showing threads Ubuntu -> sudo apt-get install htop – – press <F2> to enter htop setup menu. – – Choose “Display…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Multi-Threading

Programming

Example – Hello Thread!

hello_thread.c

Output

vvvvvvvvdddv

x

<pthread.h> library info

Ref:

Tools for showing threads

NCTU Workstation > top

(THR means the num of threads under the process)

Tools for showing threads

  • Ubuntu -> sudo apt-get install htop

    • – – press <F2> to enter htop setup menu.

    • – – Choose “Display option” under “Setup” column, and toggle on “Three view” and “Show custom thread names” options.

    • – – Presss <F10> to exit the setup.

Tools for showing threads

  • Mac -> Enter the terminal > top

Problem: Sum Checker-input

  • Input file: test.txt (it contains a 2D array.) Ex. (-1 means the (x=0 or y=0) of the 2D array. )

Problem: Sum Checker-rules

  • Given a 9×9 2D-array and each item of the array must be the digits 1 to 9.

  • Sum of each row, column, and each of the nine sub-grids must be the same and every digits only show once.

  • Hint:

    1. A thread to check that each sum of the rows.

    1. A thread to check that each sum of the cols.

    1. Nine threads to check each sum of the 3×3 sub-grids.

Example

Row

s

Colum

ns

3×3

subgrids

Problem: Sum

Checker-Output

Code output

Check num of the threads under your process

Problem: Sum Checker- Time

Command: time ./exe

Multi-thread Single thread

V.S

Requirements

  1. You can write codes in C/C++.

  1. You need to hand in one single-thread version and the other multi-thread version. Put all of *.c or *.cpp source files and OS_hw2_report.pdf into same compressed file. The type of compressed file must be

studentID_hw2.zip” (ex. 010101_hw2.zip)

  1. Use NCTU workstation as your environment

Deadline: 2018/10/28() PM 11:59

Filename format sample

Grade

    • Total score: 100 pts: COPY WILL GET A 0 POINT!

  1. Input sample +10 pts

  1. Two testing data + 10 pts (5 pts for each)

  1. multithreading +40 pts

( report Q3: speed up= Ts/Tm ;

Ts:Time of single thread code ; Tm:Time of multi-thread code)

  1. OS report (format OS_report.pdf) + 40 pts

  1. Incorrect filename format will get -5 pts

    • Incorrect output format will get -5 pts

DELAYED SUBMISSION WILL GET 0 POINT!

OS - hw2solution
$30.00 $24.00