Giter Site home page Giter Site logo

Comments (4)

ckirsch avatar ckirsch commented on June 10, 2024 1

@Blazefrost True. Stack separation should be covered. How about testing the shared data segment as well? If you like you could also implement Dekker's algorithm to see if that works (no atomics required).

from selfie.

Blazefrost avatar Blazefrost commented on June 10, 2024

After second thought, I think it should be fine. The main thread creates a second one, but immediately joins with it:

if (tid)
pthread_join(status);
else {

Only the second thread will call malloc, assign a value to the allocated memory, and exit:

else {
heap_variable = malloc(8);
*heap_variable = 42;
pthread_exit(0);

However, I'm open for recommendations of new tasks. I thought about creating a test whether the stacks are properly separated using some conditional nested function calls, depending on the thread ID, but the procedure prologue of the syscalls probably has this case covered already, otherwise the code to check would have a problem with the return address.

from selfie.

Blazefrost avatar Blazefrost commented on June 10, 2024

There's already the shared-data.c check for the shared data section.

I've now implemented a check that sums up all integers from 1 to 20 and used Dekker's algorithm for the critical section. This additional check is able to check shared data/heap sections (due to the sum variable and Dekker's algorithm control variables) as well as distinct stacks (due to calls to enter/leave critical sections) in PR #247.

from selfie.

ckirsch avatar ckirsch commented on June 10, 2024

@Blazefrost Awesome! Thanks a lot.

from selfie.

Related Issues (20)

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.