Giter VIP home page Giter VIP logo

swsc's People

Contributors

carlleonardsson avatar fangyi-zhou avatar fbq avatar kjellwinblad avatar kostis avatar margnus1 avatar michaliskok avatar phongngo avatar trucnguyenlam avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

swsc's Issues

Allow Incremental Saturation

  • Reuse saturation results between queries
  • For saturation rule 1, we currently miss adding a from-read edge if
    the target write is added to the graph and the graph saturated
    before the read is added to the graph.

Bug with SWSC?

Here is a benchmark that is crashed with SWSC using the commmand:
/home/magnus/swsc/build_art/src/swscc -DN=2 -- account.c
The benchmark works well with Nighugg and SWSC.
Can you take a look?

The code is:

#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>

#ifndef N
#warning "N was not defined"
#define N 5
#endif

#define INIT_MONEY 1000
#define ONE_DEPOSIT  100
#define ONE_WITHDRAW 10
#define N_DEPOSIT N
#define N_WITHDRAW 1

// shared variables
atomic_int amount;

void * deposit(void *arg)
{
  int tmp = atomic_load_explicit(&amount, memory_order_seq_cst);
  tmp = tmp + ONE_DEPOSIT;
  atomic_store_explicit(&amount, tmp, memory_order_seq_cst);
  
  return NULL;
}

void * withdraw(void *arg)
{
  int tmp = atomic_load_explicit(&amount, memory_order_seq_cst);
  tmp = tmp - ONE_WITHDRAW;
  atomic_store_explicit(&amount, tmp, memory_order_seq_cst);
  
  return NULL;
}

int main(int argc, char *argv[])
{
  pthread_t deposits[N_DEPOSIT], withdraws[N_WITHDRAW];
  
  atomic_init(&amount, INIT_MONEY);
  
  for (int i = 0; i < N_DEPOSIT; i++) {
    pthread_create(&deposits[i], NULL, deposit, NULL);
  }
  
  for (int i = 0; i < N_WITHDRAW; i++) {
    pthread_create(&withdraws[i], NULL, withdraw, NULL);
  }
  
  for (int i = 0; i < N_DEPOSIT; i++) {
    pthread_join(deposits[i], NULL);
  }
  
  for (int i = 0; i < N_WITHDRAW; i++) {
    pthread_join(withdraws[i], NULL);
  }
  
  int _amount = atomic_load_explicit(&amount, memory_order_seq_cst);
  assert(_amount != INIT_MONEY + N_DEPOSIT * ONE_DEPOSIT - N_WITHDRAW * ONE_WITHDRAW);
  
  return 0;
}

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.