Last change
on this file since 625 was
625,
checked in by alain, 5 years ago
|
Fix a bug in the vmm_remove_vseg() function: the physical pages
associated to an user DATA vseg were released to the kernel when
the target process descriptor was in the reference cluster.
This physical pages release should be done only when the page
forks counter value is zero.
All other modifications are cosmetic.
|
File size:
1.4 KB
|
Line | |
---|
1 | /////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File : pgcd.c |
---|
3 | // Date : November 2017 |
---|
4 | // Author : Alain Greiner <alain.greiner@lip6.fr> |
---|
5 | /////////////////////////////////////////////////////////////////////////////// |
---|
6 | // This single thread interactive application computes the PGCD. |
---|
7 | /////////////////////////////////////////////////////////////////////////////// |
---|
8 | |
---|
9 | |
---|
10 | #include <stdio.h> |
---|
11 | #include <stdlib.h> |
---|
12 | #include <almosmkh.h> |
---|
13 | |
---|
14 | ///////////////// |
---|
15 | void main( void ) |
---|
16 | { |
---|
17 | int opx; |
---|
18 | int opy; |
---|
19 | unsigned long long cycle; |
---|
20 | unsigned int cxy; |
---|
21 | unsigned int lid; |
---|
22 | |
---|
23 | get_cycle( &cycle ); |
---|
24 | get_core( &cxy , &lid ); |
---|
25 | |
---|
26 | printf( "\n\n[pgcd] starts on core[%x,%d] / cycle %d\n", |
---|
27 | cxy , lid , (unsigned int)cycle ); |
---|
28 | |
---|
29 | while (1) |
---|
30 | { |
---|
31 | printf("\n*******************\n"); |
---|
32 | printf("operand X = "); |
---|
33 | opx = get_uint32(); |
---|
34 | printf("\n"); |
---|
35 | printf("operand Y = "); |
---|
36 | opy = get_uint32(); |
---|
37 | printf("\n"); |
---|
38 | |
---|
39 | if( (opx == 0) || (opy == 0) ) |
---|
40 | { |
---|
41 | printf("operands must be positive and larger than 0 => exit\n"); |
---|
42 | exit( 0 ); |
---|
43 | } |
---|
44 | else |
---|
45 | { |
---|
46 | while (opx != opy) |
---|
47 | { |
---|
48 | if(opx > opy) opx = opx - opy; |
---|
49 | else opy = opy - opx; |
---|
50 | } |
---|
51 | printf("pgcd = %d", opx); |
---|
52 | } |
---|
53 | } |
---|
54 | } // end pgcd |
---|
55 | |
---|
Note: See
TracBrowser
for help on using the repository browser.