当前位置: 首页 > news >正文

下载类网站模板珠海网站设计报价

下载类网站模板,珠海网站设计报价,网页开发入门,网站建设的基础资料看到你的问题图像后#xff0c;输入信号量的目的是只允许单个进程/线程等待锁定#xff0c;如果你不使用它#xff0c;其他进程将进入等待队列 .why we need the entry semaphore条目信号量未使用任何值初始化#xff0c;如果它是全局声明的#xff0c;则它将初始化为0.因…看到你的问题图像后输入信号量的目的是只允许单个进程/线程等待锁定如果你不使用它其他进程将进入等待队列 .why we need the entry semaphore条目信号量未使用任何值初始化如果它是全局声明的则它将初始化为0.因此如果条目信号量为0则wait(条目)将仅允许单个进程进入因为wait()功能检查条目值是否小于零然后进程将进入等待队列 .How can multiple processes enter the critical section?一次只有一个过程可以在关键部分 - 否则关键部分是什么Critical Section是访问共享变量的代码段必须作为原子操作执行 . 这意味着在一组协作过程中在给定的时间点只有一个过程必须执行其关键部分 . 如果任何其他进程也想要执行其关键部分则必须等到第一个进程完成 .A general semaphore can allow multiple processes to enter the critical section area but I cannot see how that is done in this code.这是不对的如果您允许多个进程到关键部分谁想要修改共享数据那么您可以更改关键部分的平均值 . 您将在流程结束时收到错误的数据 .如果进程只读取共享数据则可以使用常规信号量允许多个进程访问关键数据不要修改共享数据 .我有非常小的代码供您展示信号量如何工作以及多个进程如何允许访问共享数据 . 你可以把它作为多个读者和作家 .semaphore mutex 1; // Controls access to the reader countsemaphore db 1; // Controls access to the databaseint reader_count; // The number of reading processes accessing the dataReader(){while (TRUE) { // loop foreverdown(mutex); // gain access to reader_countreader_count reader_count 1; // increment the reader_countif (reader_count 1)down(db); // if this is the first process to read the database,// a down on db is executed to prevent access to the// database by a writing processup(mutex); // allow other processes to access reader_countread_db(); // read the databasedown(mutex); // gain access to reader_countreader_count reader_count - 1; // decrement reader_countif (reader_count 0)up(db); // if there are no more processes reading from the// database, allow writing process to access the dataup(mutex); // allow other processes to access reader_countuse_data();// use the data read from the database (non-critical)}Writer(){while (TRUE) { // loop forevercreate_data(); // create data to enter into database (non-critical)down(db); // gain access to the databasewrite_db(); // write information to the databaseup(db); // release exclusive access to the database}
http://www.yutouwan.com/news/272778/

相关文章:

  • 创建好网站如何把浏览17zwd一起做网站普宁
  • 高邮市建设局网站株洲县建设局官方网站
  • 帮别人做网站建站公司最喜欢的网站
  • 周口网站建设73data管理系统中计算机应用实践考试
  • 中煤建设集团网站营销型网站建设推荐
  • wordpress 安装502杭州seo代理公司
  • 友情链接的网站阿里云虚拟主机做企业网站
  • 做服装团购有哪些网站有哪些WordPress好用的主题推荐
  • 椒江网站建设578做网站wordpress 文字框
  • 昆明网站设计都需要设计什么网站建设教学课件
  • 做网站买空间用共享ipwordpress快速开发
  • jsp网站开发分享网站企业员工培训内容及计划
  • 住房与城乡建设网站seo优化师
  • 广州市研发网站建设平台网店推广是什么
  • 网站界面设计要素化工行业网站设计
  • 陕西网站建设维护wordpress博客自媒体资讯主题
  • 中国做乱的小说网站wordpress写文章报错
  • 贵州网站推广jp域名
  • 用百度云服务器做网站我常用的网站有哪些类型有哪些类型有哪些
  • 陕西建设网官网三类人员小红书笔记关键词排名优化
  • 长安做网站价格石家庄现状
  • 网站开发主要内容和要求视频转网址在线生成
  • 网站建设规划方案制作做家电选招标采购哪一个网站好
  • 做网站要求付全款网站开发人员调试
  • 郑州影楼网站建设网站要怎么盈利
  • 怎样才能建设只是于自己的网站广东seo推广软件
  • 网站建设短期培训网页微信客户端下载
  • 个人网站 平台免费生成logo的软件
  • 镇江网站设计做薪酬调查的网站
  • 三河市网站建设品牌推广的方式