Fri Oct 4 11:47:04 2024
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2015-03-01

LEARN

2024-10-04 | 2024-09-04 | 2024-08-04 | 2024-07-04 | 2024-06-04 | 2024-05-04 | 2024-04-04 | 2024-03-04 | 2024-02-04 | 2024-01-04 | 2023-12-04 | 2023-11-04 | 2023-10-04 | 2023-09-04 | 2023-08-04 | 2023-07-04 | 2023-06-04 | 2023-05-04 | 2023-04-04 | 2023-03-04 | 2023-02-04 | 2023-01-04 | 2022-12-04 | 2022-11-04 | 2022-10-04 | 2022-09-04 | 2022-08-04 | 2022-07-04 | 2022-06-04 | 2022-05-04 | 2022-04-04 | 2022-03-04 | 2022-02-04 | 2022-01-04 | 2021-12-04 | 2021-11-04 | 2021-10-04 | 2021-09-04 | 2021-08-04 | 2021-07-04 | 2021-06-04 | 2021-05-04 | 2021-04-04 | 2021-03-04 | 2021-02-04 | 2021-01-04 | 2020-12-04 | 2020-11-04 | 2020-10-04 | 2020-09-04 | 2020-08-04 | 2020-07-04 | 2020-06-04 | 2020-05-04 | 2020-04-04 | 2020-03-04 | 2020-02-04 | 2020-01-04 | 2019-12-04 | 2019-11-04 | 2019-10-04 | 2019-09-04 | 2019-08-04 | 2019-07-04 | 2019-06-04 | 2019-05-04 | 2019-04-04 | 2019-03-04 | 2019-02-04 | 2019-01-04 | 2018-12-04 | 2018-11-04 | 2018-10-04 | 2018-09-04 | 2018-08-04 | 2018-07-04 | 2018-06-04 | 2018-05-04 | 2018-04-04 | 2018-03-04 | 2018-02-04 | 2018-01-04 | 2017-12-04 | 2017-11-04 | 2017-10-04 | 2017-09-04 | 2017-08-04 | 2017-07-04 | 2017-06-04 | 2017-05-04 | 2017-04-04 | 2017-03-04 | 2017-02-04 | 2017-01-04 | 2016-12-04 | 2016-11-04 | 2016-10-04 | 2016-09-04 | 2016-08-04 | 2016-07-04 | 2016-06-04 | 2016-05-04 | 2016-04-04 | 2016-03-04 | 2016-02-04 | 2016-01-04 | 2015-12-04 | 2015-11-04 | 2015-10-04 | 2015-09-04 | 2015-08-04 | 2015-07-04 | 2015-06-04 | 2015-05-04 | 2015-04-04 | 2015-03-04 | 2015-02-04 | 2015-01-04 | 2014-12-04 | 2014-11-04 | 2014-10-04

Key: Value:

Key: Value:

MESSAGE
DATE 2015-03-26
FROM Ruben Safir
SUBJECT Subject: [LIU Comp Sci] Cpt 4 HW from pr 13-18
From owner-learn-outgoing-at-mrbrklyn.com Thu Mar 26 00:10:47 2015
Return-Path:
X-Original-To: archive-at-mrbrklyn.com
Delivered-To: archive-at-mrbrklyn.com
Received: by mrbrklyn.com (Postfix)
id 6EFCD16133E; Thu, 26 Mar 2015 00:10:47 -0400 (EDT)
Delivered-To: learn-outgoing-at-mrbrklyn.com
Received: by mrbrklyn.com (Postfix, from userid 28)
id 56F4B161342; Thu, 26 Mar 2015 00:10:47 -0400 (EDT)
Delivered-To: learn-at-nylxs.com
Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89])
by mrbrklyn.com (Postfix) with ESMTP id 9574716133E
for ; Thu, 26 Mar 2015 00:10:23 -0400 (EDT)
Received: from [10.0.0.19] (unknown [96.57.23.82])
by mailbackend.panix.com (Postfix) with ESMTPSA id 75F9412593;
Thu, 26 Mar 2015 00:10:22 -0400 (EDT)
Message-ID: <551386AE.4000704-at-panix.com>
Date: Thu, 26 Mar 2015 00:10:22 -0400
From: Ruben Safir
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
MIME-Version: 1.0
To: mohammed Ghriga , 643-at-ghriga.com
Subject: [LIU Comp Sci] Cpt 4 HW from pr 13-18
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Sender: owner-learn-at-mrbrklyn.com
Precedence: bulk
Reply-To: learn-at-mrbrklyn.com

After this is programming and I need to set up for them. It will likely
be finished tomorrow
and be catching up to chapter 5 and the Unix command line stuff that I
can't wait to do :).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4.13
Determine if the following problems exhibit task or data parallelism:

• The multithreaded statistical program described in Exercise 4.21
Task, at least as i would right it

• The multithreaded Sudoku validator described in Project 1 in this
chapter.
Data, sort of. Each of the long lines are different data for the
same task and the boxes might be different taks, also multiuple times
over different data.


• The multithreaded sorting program described in Project 2 in this
chapter
Data


• The multithreaded web server described in Section 4.1
Task


4.14
A system with two dual-core processors has four processors available
for scheduling. A CPU-intensive application is running on this system.
All input is performed at program start-up, when a single file must
be opened. Similarly, all output is performed just before the program

terminates, when the program results must be written to a single
file. Between startup and termination, the program is entirely CPU -
bound. Your task is to improve the performance of this application
by multithreading it. The application runs on a system that uses the
one-to-one threading model (each user thread maps to a kernel thread).

• How many threads will you create to perform the input and output?
Explain.

One - it is a single input and it needs to wait for the interupt and DMA.
There is not much you can do to speed it up. Assuming it is large enough,
just suck it in. It says that all input must be done at start up. I would
add, however, that the devil is in the details here. If it makes more sense
to open a file and do continous or random reads, the it should be threaded,
depending on what is happenins with the data.



• How many threads will you create for the CPU-intensive portion of
the application? Explain.

4 threads, using OPM probably. You can do more incase of error blocks
or other synchonys blocks, but one thread per CPU will maximix NUMA
and bus contention.


4.15 Consider the following code segment:
pid t pid;
a.
b.
pid = fork();
if (pid == 0) { /* child process */
fork();
thread create( . . .);
}
fork();
How many unique processes are created?

4

How many unique threads are created?

2

4.16
As described in Section 4.7.2, Linux does not distinguish between
processes and threads. Instead, Linux treats both in the same way,
allowing a task to be more akin to a process or a thread depending on the
set of flags passed to the clone() system call. However, other operating
systems, such as Windows, treat processes and threads differently.
Typically, such systems use a notation in which the data structure for
a process contains pointers to the separate threads belonging to the
process. Contrast these two approaches for modeling processes and
threads within the kernel.


Yes - the Windows method SUCKS and is difficult to write on the OS
level and debug on the user level. Don't use MS products.


4.17 The program shown in Figure 4.16 uses the Pthreads API. What would
be the output from the program at LINE C and LINE P?

5 from the child and 0 from the parent...

#include
#include
#include
int value = 0;
void *runner(void *param); /* the thread */

int main(int argc, char *argv[])
{
pid t pid;
pthread t tid;
pthread attr t attr;
pid = fork();
if (pid == 0) { /* child process */
pthread attr init(&attr);
pthread create(&tid,&attr,runner,NULL);
pthread join(tid,NULL);
printf("CHILD: value = %d",value); /* LINE C */
}
else if (pid > 0) { /* parent process */
wait(NULL);
printf("PARENT: value = %d",value); /* LINE P */
}
}

void *runner(void *param) {
value = 5;
pthread exit(0);
}

4.18 Consider a multicore system and a multithreaded program written
using the many-to-many threading model. Let the number of user-level
threads in the program be greater than the number of processing cores
in the system. Discuss the performance implications of the following
scenarios.


A) The number of kernel threads allocated to the program is less than
the number of processing cores.

user threads that need kernel resources will be blocked and qued as
necessary


B) The number of kernel threads allocated to the program is equal to
the number of processing cores.

That should allow for one thread per kernel thread and max out utilization



C) The number of kernel threads allocated to the program is greater
than the number of processing cores but less than the number of
user-level threads.

Kernel threads are expensive and should be reduced by the OS instead of
wasting resources
although there is a significant cost to starting threads.



  1. 2015-03-01 Ruben <ruben.safir-at-my.liu.edu> Subject: [LIU Comp Sci] Fwd: Re: Linked List Test Question
  2. 2015-03-02 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] [ruben-at-mrbrklyn.com: fork problem]
  3. 2015-03-03 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Re: fork problem
  4. 2015-03-04 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Mid term in Allorithms
  5. 2015-03-04 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Mid term in Allorithms
  6. 2015-03-04 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Mid term in Allorithms
  7. 2015-03-04 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Mid term in Allorithms
  8. 2015-03-04 Ruben Safir <ruben.safir-at-my.liu.edu> Re: [LIU Comp Sci] Mid term in Allorithms
  9. 2015-03-04 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Mid term in Allorithms
  10. 2015-03-04 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Kanpsack problemi
  11. 2015-03-04 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Mid term in Allorithms
  12. 2015-03-05 Kamran <kamran.mirzayev-at-my.liu.edu> Re: [LIU Comp Sci] Canonical's 2015 OpenStack Roadshow
  13. 2015-03-05 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] Canonical's 2015 OpenStack Roadshow
  14. 2015-03-05 Ruben <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Forks - Operating systems class
  15. 2015-03-06 Ruben <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] KDE Mentoring -
  16. 2015-03-06 Ruben <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] networking class
  17. 2015-03-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Operating Systems class submition
  18. 2015-03-08 From: "keisha.sylvester" <keisha.sylvester-at-my.liu.edu> RE: [LIU Comp Sci] Operating Systems Supplement Text
  19. 2015-03-08 Ruben <ruben.safir-at-my.liu.edu> Re: [LIU Comp Sci] Operating Systems Supplement Text
  20. 2015-03-08 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Operating systems HW
  21. 2015-03-08 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Operating Systems Supplement Text
  22. 2015-03-08 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Re: Operating systems HW
  23. 2015-03-11 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Operating Systems class submition
  24. 2015-03-11 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] February Journal almost completed
  25. 2015-03-16 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] Operating Systems Chapter 3 HW complete
  26. 2015-03-16 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] [ruben-at-mrbrklyn.com: os hw]
  27. 2015-03-17 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Fwd: NYC local: UNIGROUP 19-MAR-2015 (Thu): Penguin Computing presents
  28. 2015-03-19 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] LIU Center for Entrepreneurship + Innovation
  29. 2015-03-20 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Optimum
  30. 2015-03-20 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] [jkeen-at-verizon.net: 2nd New York City Perl Hackathon: hold the
  31. 2015-03-22 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Re: Kernel thread scheduling
  32. 2015-03-22 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] [jkeen-at-verizon.net: New York City Perl Hackathon 2015: Registration
  33. 2015-03-22 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] [vinc94-at-gmail.com: Re: Kernel thread scheduling]
  34. 2015-03-22 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] [xerofoify-at-gmail.com: Re: Kernel thread scheduling]
  35. 2015-03-23 Keisha Sylvester <keisha.sylvester-at-my.liu.edu> Re: [LIU Comp Sci] Meeting Announcement II
  36. 2015-03-23 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Meeting Announcement II
  37. 2015-03-23 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] [gabor-at-szabgab.com: [Perlweekly] #191 - Hackathon after Hackathon]
  38. 2015-03-24 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] GNU/Linux 1
  39. 2015-03-24 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] GNU/Linux 1
  40. 2015-03-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] GNU/Linux 1
  41. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] GNU/Linux 1
  42. 2015-03-25 Ruben <ruben.safir-at-my.liu.edu> Re: [LIU Comp Sci] GNU/Linux 1
  43. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] GNU/Linux 1
  44. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] decent threading outline that fills in where our notes let off
  45. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] I love this HW problem
  46. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Java Crimes
  47. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] jobs jobs
  48. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Threaded Programming example
  49. 2015-03-25 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Threads and Speed
  50. 2015-03-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Cpt 4 HW from pr 13-18
  51. 2015-03-26 Ruben <ruben.safir-at-my.liu.edu> Subject: [LIU Comp Sci] Fwd: [NYLXS - HANGOUT] GNU/Linux 1
  52. 2015-03-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Kernel Learning Resource - #1
  53. 2015-03-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] AVl Trees
  54. 2015-03-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Re: Cpt 4 HW Programming Project 4-20 (and 3-20)
  55. 2015-03-28 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Jobs
  56. 2015-03-28 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] JOUNAL MEETING AT 10AM TOMORROW
  57. 2015-03-29 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Fwd: usage of dma_common_mmap
  58. 2015-03-30 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] HW 4.18 Problem

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!