代写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实验报告...相关推荐

  1. 小学生python编程写游戏_小学生开始学Python,开发AI的首选编程语言:推荐一波Python书单...

    AlphaGo 都在使用的 Python 语言,是最接近 AI 的编程语言. 教育部考试中心近日发布了"关于全国计算机等级(NCRE)体系调整"的通知,决定自2018年3月起,在全 ...

  2. python利用写模块_使用C++编写python扩展模块

    简介 长话短说,这里说的扩展Python功能与直接用其它语言写一个动态链接库,然后让Python来调用有点不一样(虽然本质是一样的).而是指使用Python本身提供的API,使用C++来对Python ...

  3. python简历怎么写开发_了解如何为Python开发人员制作简历

    成为一种经过认证的专业Python编程语言在过去的二十年里取得了很大的进步.随着它在数据科学.人工智能和机器学习领域的巨大贡献,它已经成为21世纪最流行的语言之一.不断增长的创新和技术进步为任何pyt ...

  4. python经典题库和答案_吐血总结,Python经典面试题及答案

    1.python下多线程的限制以及多进程中传递参数的方式? python多线程有个全局解释器锁(global interpreter lock),这个锁的意思是任一时间只能有一个线程使用解释器,跟单c ...

  5. python在建筑施工方面的应用_有哪些关于 Python 在建筑中的应用和教程?

    2018.02.09更新 (發現距離上一次更新馬上就要兩年了--) 嗯,兩年間發生了很多事.我也莫名其妙跑到ETH來了. 做起了Fab的優化,python已經完全不能滿足效率和複雜度的要求,走上了C+ ...

  6. python中一个范围怎么表示_我应该如何处理Python中的包含范围?

    我在一个领域工作,在这个领域中,范围通常被包括在内地描述.我有人类可读的描述,例如from A to B,它表示包含两个端点的范围,例如from 2 to 4表示2, 3, 4. 在Python代码中 ...

  7. python以运行效率高著称吗_几个提升Python运行效率的方法之间的对比

    在我看来,python社区分为了三个流派,分别是python 2.x组织,3.x组织和PyPy组织.这个分类基本上可以归根于类库的兼容性和速度.这篇文章将聚焦于一些通用代码的优化技巧以及编译成C后性能 ...

  8. python培训的课时是多久_如何快速学习python,学习python的最短时间是多久?

    在我们即将迈入python培训课堂之前,你肯定很关注学习python的最短时间是多久,怎样才能快速学习python等问题,今天就为大家详细地回答一下这个问题,希望对你有所帮助! 这篇文章将为你的自学之 ...

  9. python画画用哪库好_小白开始学Python最著名的绘图库

    原标题:小白开始学Python最著名的绘图库 这是菜鸟学Python的第101篇原创文章 数据分析里面可视化是重要的环节,辛苦把数据采集,然后经历了很多工序的清洗之后,最后要展现给用户,最好的方法就是 ...

最新文章

  1. Oracle——15触发器
  2. 临时变量不能作为非const引用
  3. QT的QSqlTableModel类的使用
  4. mysql 快速升级_MySQL 4到5的快速升级
  5. Category 的一些事
  6. 表格列展示自动扩展_进步一点点:excel表格常规操作也能很快捷
  7. QT5开发及实例学习之九基本对话框(二)
  8. Redis——多数据库
  9. Java 多线程编程两个简单的例子
  10. java js 解析器_graphqljs具有多个参数的解析器
  11. html的form表单详解
  12. 为什么全局钩子必须写到dll里面?
  13. 华为光猫上线流程、注册失败、常见语音故障处理
  14. 小学英语口语测试软件,最新小学英语口语测试题(四年级)
  15. 【OpenCV】—图像对比度、亮度值调整
  16. 小白vba之批量数据整理(excel自动化入门)
  17. 普通住宅和非普通住宅税费
  18. 【论文翻译和解释(2)】LOF:Identifying Density-Based Local Outliers论文精读
  19. Spring注解驱动
  20. 【java】企业微信机器人消息推送

热门文章

  1. c# async/await编程
  2. Multi-Range Read (MRR)原理
  3. redis管道的使用
  4. Linux下的查找命令
  5. 日跑几十万作业,唯品会HDFS是如何优化的
  6. java基础---System类
  7. dart系列之:浏览器中的舞者,用dart发送HTTP请求
  8. java学习笔记十三
  9. Copy-On-Write读写分离策略和CopyOnWriteArrayList源码分析
  10. 【已解决】Errors during downloading metadata for repository ‘appstream‘: - Status code: 404 for