Coder Social home page Coder Social logo

distributed_systems_assignment_4's Introduction

Problem 1

  • The idea is to spawn N processes and give the token to process 0
  • Each token is passed by process i to process i+1
  • The N-1 process passes it to process 0
  • To Name the processes as 0,1,2...N-1; register is used, as register cant handle integers directly, Pid I is converted to string and finally an atom
  • Each process on getting the token, writes to the Output file
  • Process 0 first sends the token, and recieves it from process N-1 and then prints it.
  • All other processes print as soon as the token is received and forward the token to the next process

Problem 2

  • The idea is to split the original list to N pieces each piece is individually sorted and finally all the results are combined
  • Given L length list and N processes
  • The main process spawns N=16 children
  • The first N-1 processes get L/N-1 elements, whereas the last processes gets the left over L%N-1 elements
  • Each process calls merge sort recursively and uses the inbuilt merge function
  • After each processes is done it sends its sorted list to the parent
  • The parent then merges them starting with the empty list and merging the incoming list
  • After all lists are merged into a single list, the parent process writes it into a file

distributed_systems_assignment_4's People

Contributors

7vikpeculiar 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.