unix programming getusage()

Create the program ‘rusage’ that will run a program provided on the command

line and then print out the resources used by the process using the system call

getrusage(). 

The timeval structure (documented in the timeradd man page):

  struct timeval {

    time_t      tv_sec;     /* seconds */

    suseconds_t tv_usec;    /* microseconds */

  };

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

Network Modification

  • What are network layers? 
  • What is the OSI Model? 
  • What is the TCP/IP stack? 
  • Are there any other layering models/stacks/implementations? 
  • Why is a layering approach taken in networking? 
  • What is meant by a client/server network? 
  • How does it differ from a peer-to-peer network?  What is a server? 
  • What is a service? 
  • Is your router a server? 
  • Is your computer a server? 
  • What is Zeroconf? 
  • What is a host? 
  • What is a node? 
  • What are network topologies? 
  • What are bus networks?  Ring networks?  Star networks?  Tree networks?  Mesh networks? 
  • Are there any other network topologies? 
  • Is there a difference between physical and functional topologies? 
  • Which topology is best?  

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

OS program regarding shared memory

NEED TO Submit ‘producer.c’ and ‘consumer.c’ in the Linux machine.

Read the following document for programming assigment.

Download two programs ‘producer.c’ and ‘consumer.c’ and add your code there so that producer send a list of items to consumer. Producer read the item from a file ‘input.txt’.

In order to use shared memory library, compilation need to link a library ‘rt’. And since we will run two programs, we need to create two executables. See below.

Download ‘hw2.c’. It is a file that contains the definition of shared memory structure and a function to print current time. It is already included in ‘producer.c’ and ‘consumer.c’. You don’t need to change this file. You don’t need to compile it. ‘Producer.c’ and ‘consumer.c’ already include the file. Just keep ‘hw2.c’ in the same folder with other files.

‘read_example.c’ is an example file to show you how to read the input file and to show how to print with time stamps.

You need to copy ‘input.txt’ in the same folder and test as below.

Following is a sample run.

Run producer first. It need to read a number after another from the file and display while sending them to consumer. Since the consumer is not started, the buffer will become full soon and producer will wait.

Now run consumer as below. It need to display all items received. It keeps running until it gets end-of-item message ‘-1’

After consumer begins, the producer will also proceed to read all items from the file and end.

read_example.c:

#include <stdio.h>

#include <stdlib.h>

#include “hw2.c”

int main()

{

        int     item;

        FILE    *fp;

        fp = fopen(“input.txt”,”r”);

        while(fscanf(fp, “%d”,&item)!= EOF){

                printf(“%s Read %d from the file\n”,get_time(),item);

        }

        fclose(fp);

}

producer.c:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <fcntl.h>

#include <sys/shm.h>

#include <sys/stat.h>

#include <sys/mman.h>

#include “hw2.c”

int main()

{

        const int SIZE = sizeof(shm_structure);

        const char *name = “OS-ipark”; // ATTENTION: Change this using YOUR id to avoid conflicts with others

        int     item;

        FILE    *fp;

        int shm_fd;

        shm_structure *ptr;

        /* create the shared memory segment */

        shm_fd = shm_open(name, O_CREAT | O_RDWR, 0666);

        /* configure the size of the shared memory segment */

        ftruncate(shm_fd,SIZE);

        /* now map the shared memory segment in the address space of the process */

        ptr = mmap(0,SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);

        if (ptr == MAP_FAILED) {

                printf(“Map failed\n”);

                return -1;

        }

        /*****************************************************

        Add your code here.

        Read one item after another from the file ‘input.txt’.

        And write it to the shared memory so the consumer can read.

        Need to wait if the buffer is full

        *****************************************************/

        printf(“Success\n”);

        return 0;

}

input.txt:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

32

64

128

256

512

1024

2048

4096

11

22

33

44

55

66

77

88

-1

consumer.c:

#include <stdio.h>

#include <stdlib.h>

#include <fcntl.h>

#include <sys/shm.h>

#include <sys/stat.h>

#include <sys/mman.h>

#include “hw2.c”

int main()

{

        const char *name = “OS-ipark”; // ATTENTION: Change this to the same name you used in producer.c

        const int SIZE = sizeof(shm_structure);

        int shm_fd;

        shm_structure *ptr;

        int i;

        int item;

        /* open the shared memory segment */

        shm_fd = shm_open(name, O_RDWR, 0666);

        if (shm_fd == -1) {

                printf(“shared memory failed\n”);

                exit(-1);

        }

        /* now map the shared memory segment in the address space of the process */

        ptr = mmap(0,SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);

        if (ptr == MAP_FAILED) {

                printf(“Map failed\n”);

                exit(-1);

        }

        /***************************************************

        Add your code for consumer here.

        Read an item after another from the shared memory

        And display to screen using printf().

        Need to wait if the buffer is empty.

        Check if this displays all the items in ‘input.txt’ 

        except end-of-message signal ‘-1’

        ***************************************************/

        

        /* remove the shared memory segment */

        if (shm_unlink(name) == -1) {

                printf(“Error removing %s\n”,name);

                exit(-1);

        }

        return 0;

}

hw2.c:

// Definitions for shared memory structure

#define BUFFER_SIZE 10

typedef struct{

        int buffer[BUFFER_SIZE];

        int in;

        int out;

} shm_structure;

#include <time.h>

char time_str[100];

char *get_time()

{

        

        time_t t=time(NULL);    // get time info (month, day, hour, min)

        struct tm *tm1 = localtime(&t); // convert to easy format

        struct timeval tv;

        struct tm *tm;

        gettimeofday(&tv, NULL);    // get time info (month, day, hour, min)

        tm=localtime(&tv.tv_sec);   // convert to easy format

        sprintf(time_str,”(%02d/%02d %d:%d:%d %d)”, tm1->tm_mon+1,tm1->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, tv.tv_usec);

        return time_str;

}

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

Midterm Research Paper

This week, you have read about entrepreneurship in a global economy. For your written assignment this week, complete a case study of the organization you work for (use a hypothetical or “other” organization if more applicable) that will address the following prompts:

  • Describe the organization’s environment, and evaluate its preparedness to go global, if not already, and it’s strategy for staying global if it is.
  • Research other company’s strategy for going global and explain if this will or will not work for your company. 
  • Make a recommendation for a global strategy in the organization, including a justification for your recommendations.

Submit your midterm research paper as a single document. Your paper should meet the following requirements:

  • Be approximately four to six pages in length, not including the required cover page and reference page.
  • Follow APA 7 guidelines. Your paper should include an introduction, a body with fully developed content, and a conclusion.
  • Support your answers with the readings from the course and at least two scholarly journal articles to support your positions, claims, and observations, in addition to your textbook. The UC Library is a great place to find resources.
  • Be clearly and well-written, concise, and logical, using excellent grammar and style techniques. You are being graded in part on the quality of your writing.

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

IT345 Week 7 A

Week 7 Discussion

2727 unread replies.2727 replies.

Welcome to Week 7

This week we will cover how to evaluate information and control technology. This is a popular topic because some will say that most information on the internet is fake. Others will say that it is biased or manipulated. Ultimately, you need to have a reasonable amount of judgement to ensure the information you are reading is legitimate.

Moreover, as technology evolves and expands, users and businesses are faced with constant decisions about what is right for them or their business. What drives adoption? What makes products successful? Does the business need the new technology or does the new technology create the need?

Pick a topic below and post your reply by Wednesday at midnight. Your response should be at least 400 words and appropriately cites your resources.

Respond to two of your classmates by Sunday at midnight. Your responses should be at least 200 words and should be substantive. You should offer additional resources, insight, or other helpful feedback. A simple “I like your post” will result in a 0.

You will not be able to see your classmates’ posts until you make your first post.

Topics:

  • How well can we predict the consequences of a new technology or application?
  • Who should make the decision for a business on what technology the adopt?
  • What does the term “need for reasonable judgement” mean?
  • Do sites like Wikipedia hold any credibility?

Search entries or author

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

IT345 Week 7 B

Discussion 7B

77 unread replies.77 replies.

Find a recent article that relates to this week’s topic and post a summary of that article and how it relates to this week’s lesson.

Post your reply by Wednesday at midnight. Your response should be at least 200 words and appropriately cite your resources.

Respond to two of your classmates by Sunday at midnight. Your responses should be at least 100 words and should be substantive. You should offer additional resources, insight, or other helpful feedback. A simple “I like your post” will result in a 0.

You will not be able to see other posts until you make your first post.

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

IT345 Week 8 A

Week 8 Discussion

2929 unread replies.2929 replies.

Welcome to Week 8

With any invention there will be trial and error. When it comes to technology, the errors can be extremely costly, more frequent, and sometimes deadly. Software applications are so in depth, that they are almost always released with bugs. On the opposite end of the spectrum, some technology has made our lives safer and even extended our life span. Put your proverbial “critical thinking” hats on for this week.

Pick a topic below and post your reply by Wednesday at midnight. Your response should be at least 400 words and appropriately cites your resources.

Respond to two of your classmates by Sunday at midnight. Your responses should be at least 200 words and should be substantive. You should offer additional resources, insight, or other helpful feedback. A simple “I like your post” will result in a 0.

You will not be able to see your classmates’ posts until you make your first post.

Topics:

  • Do you believe we are too dependent on computers? Why or why not?
  • In what ways are we safer due to new technologies?
  • What are some recent examples of technology that has been created that is used to “save lives”?
  • What technologies have inadvertently taken lives?

Search entries or author

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

IT345 Week 8 B

Discussion 8 B

Find a recent article that relates to a software that has malfunctioned and caused either serious injury, death, or loss of revenue. Summarize the article and discuss whether you believe this will impact the adoption of this type of technology.

Post your reply by Wednesday at midnight. Your response should be at least 250 words and appropriately cite your resources.

Respond to two of your classmates by Sunday at midnight. Your responses should be at least 100 words and should be substantive. You should offer additional resources, insight, or other helpful feedback. A simple “I like your post” will result in a 0.

You will not be able to see other posts until you make your first post.

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

IT345 Week 9 A

Week 9 Discussion –

2222 unread replies.2222 replies.

Welcome to Week 9

To conclude this course, we cover professional ethics as it relates to technology. Additionally, we specifically address ethics as it relates to computer professional. This is due to the amount of private, sensitive, and proprietary information they have access to.

Pick a scenario below and post your reply by Wednesday at midnight. Your response should be at least 300 words and appropriately cites your resources.

Respond to two of your classmates by Sunday at midnight. Your responses should be at least 150 words and should be substantive. You should offer additional resources, insight, or other helpful feedback. A simple “I like your post” will result in a 0.

You will not be able to see your classmates’ posts until you make your first post.

  • Scenario 1
    • Your company is developing a free email service that will include targeted advertising based on the content of the email messages (similar to Google’s Gmail). You are part of the team designing the system. What are your ethical responsibilities?
  • Scenario 2
    • As part of your responsibilities, you oversee the installation of software packages for large orders. A recent order of laptops for a local school district requires webcam software to be loaded. You know that this software allows for remote activation of the webcam. What are your ethical responsibilities? What would you do?
  • Scenario 3
    • Three MIT students planned to present a paper at a security conference describing security vulnerabilities in Boston’s transit fare system. At the request of the transit authority, a judge ordered the students to cancel the presentation and not to distribute their research. The students are debating whether they should circulate their paper on the Web. Imagine that you are one of the students. What would you do?

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

IT345 Week 9 B

Discussion 9B

Summarize what you have learned over the last 9 weeks. Has it changed your opinion about technology? Do you believe technology will continue to evolve? What businesses should concerned about being “phased” out due to new technology?

Post your reply by Wednesday at midnight. Your response should be at least 200 words and appropriately cite your resources.

Respond to two of your classmates by Sunday at midnight. Your responses should be at least 100 words and should be substantive. You should offer additional resources, insight, or other helpful feedback. A simple “I like your post” will result in a 0.

You will not be able to see other posts until you make your first post.

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now