GithubHelp home page GithubHelp logo

golang_multi_thread_system_call's Introduction

Workaround for issue with system call from multiple threads in parallel

Demo of issue.

go build test_concurrency.go

./test_concurrency.go

Running the functions sequentially:

Current directory from change_into_directory_1(): *** This is file 1 ***

Current directory from change_into_directory_2(): *** This is file 2 ***

--------------- Running the functions in parallel ---------------

Current directory from change_into_directory_2(): Current directory from change_into_directory_1(): *** This is file 2 ***

<<< ERROR getting file 1 from directory 1>>>


O/S system calls to change the directory in thread_1 & thread_2 [functions change_into_directory_1() & change_into_directory_2()] are not remaining indenpendent of one another. They seem to be sharing system state resources underneath, implying the code is not re-entrant.

EXPECTED BEHAVIOUR: That thread_2 does not reflect the current O/S directory state of thread_1 and operates independently of thread_1 including at the O/S level, so that the functions which are run in parallel remain fully re-entrant from the point-of-view of the caller.

JAVA CASE

Java copes with a similar use case. To run the java:

cd JAVA_TEST

javac *.java

java Concurrency_Test

golang_multi_thread_system_call's People

Contributors

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