Εγγραφή τριών ακεραίων (125, 34, -7) σε αρχείο:
- ως δυαδικό αρχείο
- ως αρχείο κειμένου
Σε σχόλιο το αποτέλεσμα (hexdump).
Εγγραφή τριών ακεραίων (125, 34, -7) σε αρχείο:
Σε σχόλιο το αποτέλεσμα (hexdump).
import pydot | |
# create the pydot directed graph | |
g = pydot.Dot(graph_type='digraph',splines='true',overlap='false',size='80.0,80.0') | |
# add a graph node | |
node = pydot.Node("n1",shape='circle',style='filled',fillcolor='#FFFFFF',fontsize='8',margin='0') | |
node.set_label('"α"') | |
g.add_node(node) |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/time.h> | |
#include <pthread.h> | |
// Sample vector addding program using pthreads | |
// compile with: | |
// gcc -O2 -Wall -pthread vectoradd-pthreads.c -o vectoradd-pthreads -DTHREADS=16 -DN=100000 -DR=50000 | |
// use R>=1000, N=100000, THREADS= 1,2,4,6,8,16,32 |
Παραδείγματα χρήσης mutex, condition variables, barrier.
mutex-example.c - αμοιβαία αποκλειόμενη ενημέρωση σφαιρικού (global) μετρητή
cv-example.c - παράδειγμα producer-consumer με buffer ενός στοιχείου
barrier-example.c - παράλληλο άθροισμα (parallel sum reduction). Προσοχή: κατάλληλο μόνο για παράδειγμα, όχι για αληθινές εφαρμογές pthreads!