Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

Reply
Thread Tools

Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

 
 
Daniel Fetchinson
Guest
Posts: n/a
 
      09-10-2008
> I know I'm tooooo late to ask you for help....but please help me out..I
> am really new to unix and dont know how to finish this assignment on
> time.....proff. said he will be using MOSS to detect whether I
> downloaded the code..please help me..
>
> email me : http://www.velocityreviews.com/forums/(E-Mail Removed)
>
> Assignment 1
> Processes, Inter-Process Communication, and Concurrency
> Due September 13th midnight
> Summary
> In
> this assignment, you will create two versions of a simple multi-process
> game : one without and another with inter-process synchronization. You
> will also measure the relative performance of the two versions of your
> multi-process game.
> Objectives
>
> * Learn how to create and terminate processes.
> * Learn use of inter-process communication using shared memory,
> semaphores, signals, etc.
> * Learn the basic workings of CPU scheduling code in Linux.
>
> Part A: Multi-Process Game of Turns
>
> In
> this part, you are asked to write a simple program that takes two
> command-line arguments P and N. The main process creates P other child
> processes, waits for all of them to complete, and then exits. All the
> child processes form one logical ring among each other. (In rest of the
> description, the term "process" refers to a "child process".) For
> example, if the processes are numbered 1 to P, then
>
> * The next neighbor of process 1 is process 2,
> * The next neighbor of process i is process i+1 for all i < P , and
> * The next neighbor of process P is process 1, which completes a ring
> among the processes.
>
> Assume
> that a shared integer variable, called turn, identifies the number of
> the processes whose turn it is at any instant. A second process-local
> variable in each process, called me, identifies the identity of each
> process (i.e. each process stores its own identity in a per-process
> local variable me). A third per-process local variable, called next,
> identifies the next process in the ring.
>
> The processes
> sequentially pass the turns among each other in the logical ring. When
> each process gets its turn, it increments another shared variable
> called counter. The pseudo-code within each process for passing turns
> might look something as follows. (Note: Replace turn and counter below
> with appropriate ways of accessing data within shared memory regions).
>
> while(turn != me )
> /* do nothing - just busy loop*/ ;
>
> /* got my turn - increment counter */
> counter = counter + 1;
>
> /* give the turn to next process */
> turn = next;
>
> The program terminates when the each process has received N turns.
>
> In the above description, several programming details have been omitted for
> you to figure out. This includes
>
> * Creating P child processes from main process.
> * Constructing the logical ring among child processes.
> o Initializing each child process's identity in the me variable.
> o Initializing each child process' next neighbor in the next
> variable.
> * Initializing the shared memory region and the shared data values.
> * Have the main process wait for child processes to complete N turns
> before exiting.
>
> Part B: More Efficient Game of Turns
>
> You
> might notice that the program you wrote in Part A is inefficient
> because each process busy loops till the CPU scheduler kicks it out
> (after its time-slice is over) and allows another process to execute
> and make progress. (Does the program in Part A have a race condition?
> Why or why not?)
>
> What we ideally want is that each process
> should be given control of the CPU only when it is that process' turn.
> Modify the program you wrote in Part A (using appropriate
> synchronization mechanisms) such that each process gets to run (i.e.,
> gets control of the CPU) only when it is that process's turn, and at no
> other time.
>
> Again, you would need to work out the programming details of how and where
> to use inter-process synchronization.
> Part C: Profiling the Game of Turns
>
> In
> this part, you are asked to write user-level profiling code in order to
> measure the performance of the two versions of programs you wrote in
> Part A and Part B. Use a combination of gettimeofday() system call and
> inter-process synchronization to measure (1) the average hand-over time
> between two consecutive processes in the ring and (b) the total
> execution time to complete N turns. Plot the measured values as graphs
> when varying number of processes P and number of turns N. Explain the
> results you obtain.
> Submission Guidelines
>
> Thanking you,
>
> Ms. Vaidehi Pawar


How much do you pay?

Cheers,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
 
Reply With Quote
 
 
 
 
Sean DiZazzo
Guest
Posts: n/a
 
      09-11-2008
On Sep 10, 3:33*pm, "Daniel Fetchinson" <(E-Mail Removed)>
wrote:
> > I know I'm tooooo late to ask you for help....but please help me out..I
> > am really new to unix and dont know how to finish this assignment on
> > time.....proff. said he will be using MOSS to detect whether I
> > downloaded the code..please help me..

>
> > email me : (E-Mail Removed)

>
> > Assignment 1
> > Processes, Inter-Process Communication, and Concurrency
> > Due September 13th midnight
> > Summary
> > In
> > this assignment, you will create two versions of a simple multi-process
> > game : one without and another with inter-process synchronization. You
> > will also measure the relative performance of the two versions of your
> > multi-process game.
> > Objectives

>
> > * * * Learn how to create and terminate processes.
> > * * * Learn use of inter-process communication using shared memory,
> > semaphores, signals, etc.
> > * * * Learn the basic workings of CPU scheduling code in Linux.

>
> > Part A: Multi-Process Game of Turns

>
> > In
> > this part, you are asked to write a simple program that takes two
> > command-line arguments P and N. The main process creates P other child
> > processes, waits for all of them to complete, and then exits. All the
> > child processes form one logical ring among each other. (In rest of the
> > description, the term "process" refers to a "child process".) For
> > example, if the processes are numbered 1 to P, then

>
> > * * * The next neighbor of process 1 is process 2,
> > * * * The next neighbor of process i is process i+1 for all i < P , and
> > * * * The next neighbor of process P is process 1, which completes a ring
> > among the processes.

>
> > Assume
> > that a shared integer variable, called turn, identifies the number of
> > the processes whose turn it is at any instant. A second process-local
> > variable in each process, called me, identifies the identity of each
> > process (i.e. each process stores its own identity in a per-process
> > local variable me). A third per-process local variable, called next,
> > identifies the next process in the ring.

>
> > The processes
> > sequentially pass the turns among each other in the logical ring. When
> > each process gets its turn, it increments another shared variable
> > called counter. The pseudo-code within each process for passing turns
> > might look something as follows. (Note: Replace turn and counter below
> > with appropriate ways of accessing data within shared memory regions).

>
> > * * while(turn != me )
> > * * * * /* do nothing - just busy loop*/ ;

>
> > * * /* got my turn - increment counter */
> > * * counter = counter + 1;

>
> > * * /* give the turn to next process */
> > * * turn = next;

>
> > The program terminates when the each process has received N turns.

>
> > In the above description, several programming details have been omitted for
> > you to figure out. This includes

>
> > * * * Creating P child processes from main process.
> > * * * Constructing the logical ring among child processes.
> > * * * * * o Initializing each child process's identity in the me variable.
> > * * * * * o Initializing each child process' next neighbor in the next
> > variable.
> > * * * Initializing the shared memory region and the shared data values.
> > * * * Have the main process wait for child processes to complete N turns
> > before exiting.

>
> > Part B: More Efficient Game of Turns

>
> > You
> > might notice that the program you wrote in Part A is inefficient
> > because each process busy loops till the CPU scheduler kicks it out
> > (after its time-slice is over) and allows another process to execute
> > and make progress. (Does the program in Part A have a race condition?
> > Why or why not?)

>
> > What we ideally want is that each process
> > should be given control of the CPU only when it is that process' turn.
> > Modify the program you wrote in Part A (using appropriate
> > synchronization mechanisms) such that each process gets to run (i.e.,
> > gets control of the CPU) only when it is that process's turn, and at no
> > other time.

>
> > Again, you would need to work out the programming details of how and where
> > to use inter-process synchronization.
> > Part C: Profiling the Game of Turns

>
> > In
> > this part, you are asked to write user-level profiling code in order to
> > measure the performance of the two versions of programs you wrote in
> > Part A and Part B. Use a combination of gettimeofday() system call and
> > inter-process synchronization to measure (1) the average hand-over time
> > between two consecutive processes in the ring and (b) the total
> > execution time to complete N turns. Plot the measured values as graphs
> > when varying number of processes P and number of turns N. Explain the
> > results you obtain.
> > Submission Guidelines

>
> > Thanking you,

>
> > Ms. Vaidehi Pawar

>
> How much do you pay?
>
> Cheers,
> Daniel
> --
> Psss, psss, put it down! -http://www.cafepress.com/putitdown


Maybe. If I cant sleep tonite.
 
Reply With Quote
 
 
 
 
Stephen Johnson
Guest
Posts: n/a
 
      09-11-2008
I found Logix (http://livelogix.net/logix/) while looking for
something else and thought it looked like a very interesting project.
Unfortunately, the blog, mailing list, and Trac links are broken, and
the contact email address bounces.

I am interested in playing with it and working on it if the original
author has dropped it. Does anyone know where I could get the source?

I am asking this here because Logix compiles to Python bytecode, and
the author announced to this list at one time. Tom Locke, if you're
out there...

-Steve Johnson (www.steveasleep.com)
 
Reply With Quote
 
John Machin
Guest
Posts: n/a
 
      09-11-2008
On Sep 11, 10:34*am, Stephen Johnson <(E-Mail Removed)> wrote:
> I found Logix (http://livelogix.net/logix/) while looking for *
> something else and thought it looked like a very interesting project. *
> Unfortunately, the blog, mailing list, and Trac links are broken, and *
> the contact email address bounces.
>
> I am interested in playing with it and working on it if the original *
> author has dropped it. Does anyone know where I could get the source?


Ummmm .... try the download link; it worked for me.

>
> I am asking this here because Logix compiles to Python bytecode, and *
> the author announced to this list at one time. Tom Locke, if you're *
> out there...
>
> -Steve Johnson (www.steveasleep.com)


 
Reply With Quote
 
Stephen Johnson
Guest
Posts: n/a
 
      09-11-2008
> Ummmm .... try the download link; it worked for me.

Oops. You just found my daily stupid.

However, I still wish the Trac link worked, and I would prefer the
participation of the original dev to forking it.

-Steve Johnson
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please please please help this guy with his open source java app casioculture@gmail.com Java 4 05-05-2005 08:24 AM
Console profile for Windows app in VC++ - PLEASE PLEASE PLEASE HELP! MuZZy C++ 7 01-07-2005 08:40 PM
Computer problems please please please help Nick Computer Support 0 06-04-2004 08:49 PM
HELP! HELP! PLEASE, PLEASE, PLEASE tpg comcntr Computer Support 11 02-15-2004 06:22 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments