Coder Social home page Coder Social logo

1091528_proj_4's Introduction

Prog 1

完成功能:

i. 父行程可以從命令列正確讀取參數

ii. 父行程用fork()產生一個子行程,且模擬過程中只有一個子行程。每個行程執行過程中,亂數 只用給定的亂數種子設定一次。

iii. shared memory空間只有一塊,而且父行程與子行程只用同一塊 shared memory空間來傳遞正確 的炸射結果給對方。

iv. 父行程與子行程有一個使用POSIX shared memory的同步機制,可以讓父行程與子行程的運作 正確同步。

程式過程:

使用同一塊posix shared memory 空間,利用ptr指向此空間。我是使用ptr[0],這種類似陣列的方式去存取我要傳送給father/child的資料,也藉由shared memory去完成同步的工作。

傳進參數5 10 0與 10 99 0去測後,能夠跑出正確的順序,也能夠判斷是誰贏。

1091528_proj_4's People

Contributors

jumpingxuan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.