lab project 1

Description

due march 22nd at 11:00pm. I’ll tell you my netID when you accept. let me know if you need anything.

Don't use plagiarized sources. Get Your Custom Assignment on
lab project 1
From as Little as $13/Page

Unformatted Attachment Preview

CSE 3320 Project 1 (Spring 2024)
Due date: 11:59pm 3/22 (Friday) (upload one .zip file in Canvas)
(1) In this project you will use the POSIX thread libraries to write multithreaded programs to solve two
problems.
(2) Please connect to the Omega server.
To access Omega from a Linux shell prompt, use the following command:
• ssh @omega.uta.edu
Note: If you are not on UTA campus, you will need to connect to UTA VPN to access Omega.
Instructions on connecting to the UTA VPN are here
*If you prefer using Visual studio code IDE, it supports ssh connection between the remote server and
your local machine. (configuration guide: https://code.visualstudio.com/docs/remote/ssh-tutorial)
You may also edit or/and debug your programs in a different platform. However, you need to test it
at the omega server before your submission.
(3) Read this sample program given below: sample-sum.c
(4) Compile and run the sample program:
$> gcc sample-sum.c -lpthread
$> ./a.out 10
(5) There are numerous online pthread sample programs and tutorial materials for your reference, such
as this one: https://www.geeksforgeeks.org/multithreading-c-2/
(6) Program naming rule: Project i may include multiple problems. The program for the jth problem
should be named as “proj-i-j.c”. If multiple programs are required for a problem, the kth program is
named as “proj-i-j-k.c”. All programs for Project i are to be in a directory named “Project-i”. An
example, in this project, you will have two programs: “Project-1/proj-1-1-1.c”, “Project-1/proj-1-1-2.c”,
“Project-1/proj-1-2-1.c”, and “Project-1/proj-1-2-2.c”. Programs that don’t follow the naming
convention will not be graded.
(7) Submission as you do with your homework assignment.
• Create a ZIPPED directory called _project-1.zip (no other forms of compression will
be accepted)
• The directory should contain:
(a) the programs mentioned in (6). Note that no need to include any binaries.
(b) a pdf report. There is an “Observation” requirement in each problem. Write your
required observation results in the pdf report.
The Sample Program:
#include
#include
int sum; /* this data is shared by the thread(s) */
void *runner(void *param); /* the thread */
int main(int argc, char *argv[])
{
pthread_t tid; /* the thread identifier */
pthread_attr_t attr; /* set of attributes for the thread */
if (argc != 2) {
fprintf(stderr,”usage: a.out n”);
/*exit(1);*/
return -1;
}
if (atoi(argv[1]) < 0) { fprintf(stderr,"Argument %d must be non-negativen",atoi(argv[1])); /*exit(1);*/ return -1; } /* get the default attributes */ pthread_attr_init(&attr); /* create the thread */ pthread_create(&tid,&attr,runner,argv[1]); /* now wait for the thread to exit */ pthread_join(tid,NULL); printf("sum = %dn",sum); } /** * The thread will begin control in this function */ void *runner(void *param) { int i, upper = atoi(param); sum = 0; if (upper > 0) {
for (i = 1; i
Purchase answer to see full
attachment