欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

python实验报告代写价格_代写OS python程序作业、代写代写OS作业、代写OS实验报告...

发布时间:2024/1/23 python 52 豆豆
生活随笔 收集整理的这篇文章主要介绍了 python实验报告代写价格_代写OS python程序作业、代写代写OS作业、代写OS实验报告... 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

代写OS python程序作业、代写代写OS作业、代写OS实验报告

日期:2018-06-11 03:21

CSE 304 - Operating Systems

DUE: June 11. Submit in class

Programming Assignment (version 2)

From this assignment, you will learn the basic concept of synchronization (e.g., critical

section).

You will create a program creating/handling multiple processes. Each process is to sort

an integer list in an increasing order. The list is a shared variable (global) among all

processes; it is initialized randomly with [0-99] at the beginning of thread in process. The

list size is 10 (insert integer at most 10 times, then sort). After initialization, the process

will sort the array without any interrupt. At the end, you will release the list for other

processes to use. You should use a semaphore to synchronize between the threads.

A. The size of list is 10.

B. The number of processes is 10.

C. Your output should include each sorted list (in a single line).

D. Your output should report the start/end time of each process. You can calculate

the execution time, perhaps using the python module like ‘timeit’

(https://docs.python.org/2/library/timeit.html).

Task 1. Create 10 sorting processes, run them, and print output like the example below.

Your output may be incorrect, not sorted correctly (meaning that there is no

synchronization among the processes). Please refer to

https://pymotw.com/2/multiprocessing/basics.html for multiprocessing module. The

filename should be ‘sort_process_task1.py’

Task 2. Using multiprocessing.lock() function (it’s equivalent to semaphore) to control

access to critical section. You allow only one process at a time. The final output should

have all 10 lists correctly sorted. The filename should be ‘sort_process_task2.py’

EXAMPLE:

>> ./sort_process_task2.py

##### Process #1 started …

##### Process #2 started …

[1]--> 0 1 2 3 4 5 6 7 8 9 0.007 sec

[2] --> 10 11 12 13 14 15 16 17 18 19 0.006 sec

SUBMISSION:

1. Print out your source code for both tasks: sort_process_task1.py &

sort_process_task2.py

2. Print out the output of your programs (task1 & task2 separately).

3. Write one paragraph explaining your development environment, your program,

and any difficulties you had (no less than 200 words).

NOTE:

1. Python is required.

2. Any platform of your choice is fine, but I’d like to see many Linux (e.g., Ubuntu)

as possible. Use your Virtualbox.

3. Take a good look at the multiprocessing module example. It’s all there.

TRIVIA:

Google is your friend and teacher. Search!

Discuss with your classmates! (DO NOT send me an email first)

I will go over the assignment in class, so don’t worry too much.

总结

以上是生活随笔为你收集整理的python实验报告代写价格_代写OS python程序作业、代写代写OS作业、代写OS实验报告...的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。