Hello,

I am trying to run a simple pthread program in gem5 SE x86 mode but it
errors out. the program is as below

#include <stdio.h>
#include <pthread.h>

int result;

void *sum(void *threadid) {
   int a=5;
   int b=5;
   result = a+b;
   printf("result from 1st thread is %d\n",result);
   pthread_exit(NULL);
}

void *diff(void *threadid) {
   int a=5;
   int b=5;
   result = a-b;
   printf("result from 2nd thread is %d\n",result);
   pthread_exit(NULL);
}


int main () {
   pthread_t thread1 , thread2;
   int rc;
   int i;

      rc = pthread_create(&thread1, NULL, sum, (void *)(i));
      rc = pthread_create(&thread2, NULL, diff, (void *)(i));

      pthread_join(thread1, NULL);
      pthread_join(thread2, NULL);


      if (rc) {
         printf("Error:unable to create thread");
      }

   pthread_exit(NULL);
   return 0;
}

And also when I run in SE mode I get the below output.

lap318@lap318-HP-Compaq-6730b-KE717AV ~/gem5 $ build/X86/gem5.opt
configs/example/se.py -n 4 -c thread
gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled Nov 28 2017 12:18:46
gem5 started Dec 14 2017 15:46:43
gem5 executing on lap318-HP-Compaq-6730b-KE717AV, pid 2871
command line: build/X86/gem5.opt configs/example/se.py -n 4 -c thread

Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range
assigned (512 Mbytes)
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
0: system.remote_gdb.listener: listening for remote gdb #1 on port 7001
0: system.remote_gdb.listener: listening for remote gdb #2 on port 7002
0: system.remote_gdb.listener: listening for remote gdb #3 on port 7003
**** REAL SIMULATION ****
MODIFIED_GEM5 is disabled.
info: Entering event queue @ 0.  Starting simulation...
warn: ignoring syscall access(...)
warn: ignoring syscall access(...)
warn: ignoring syscall access(...)
warn: ignoring syscall access(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall set_robust_list(...)
fatal: syscall futex (#240) unimplemented.
Memory Usage: 583416 KBytes


Could anybody please help me with this issue.

Regards
Nidhi
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to