Last change
on this file since 611 was
580,
checked in by alain, 6 years ago
|
1) Register the kernel process in the cluster manager local list.
2) Introduce a new service in idbg : display the set of busylocks taken by a given thread.
|
File size:
1.4 KB
|
Rev | Line | |
---|
[417] | 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 | |
---|
[436] | 10 | #include <stdio.h> |
---|
[465] | 11 | #include <stdlib.h> |
---|
[445] | 12 | #include <almosmkh.h> |
---|
[417] | 13 | |
---|
[574] | 14 | ///////////////// |
---|
[475] | 15 | void main( void ) |
---|
[417] | 16 | { |
---|
[436] | 17 | int opx; |
---|
| 18 | int opy; |
---|
| 19 | unsigned long long cycle; |
---|
[580] | 20 | unsigned int cxy; |
---|
| 21 | unsigned int lid; |
---|
[417] | 22 | |
---|
[436] | 23 | get_cycle( &cycle ); |
---|
[580] | 24 | get_core( &cxy , &lid ); |
---|
[417] | 25 | |
---|
[580] | 26 | printf( "\n\n[PGCD] starts on core[%x,%d] / cycle %d\n", |
---|
| 27 | cxy , lid , (unsigned int)cycle ); |
---|
| 28 | |
---|
[417] | 29 | while (1) |
---|
| 30 | { |
---|
| 31 | printf("\n*******************\n"); |
---|
| 32 | printf("operand X = "); |
---|
[580] | 33 | opx = get_uint32(); |
---|
[417] | 34 | printf("\n"); |
---|
| 35 | printf("operand Y = "); |
---|
[580] | 36 | opy = get_uint32(); |
---|
[417] | 37 | printf("\n"); |
---|
| 38 | |
---|
| 39 | if( (opx == 0) || (opy == 0) ) |
---|
| 40 | { |
---|
[446] | 41 | printf("operands must be positive and larger than 0 => exit\n"); |
---|
| 42 | exit( 0 ); |
---|
[417] | 43 | } |
---|
| 44 | else |
---|
| 45 | { |
---|
| 46 | while (opx != opy) |
---|
| 47 | { |
---|
| 48 | if(opx > opy) opx = opx - opy; |
---|
| 49 | else opy = opy - opx; |
---|
| 50 | } |
---|
[442] | 51 | printf("pgcd = %d", opx); |
---|
[417] | 52 | } |
---|
| 53 | } |
---|
| 54 | } // end pgcd |
---|
| 55 | |
---|
Note: See
TracBrowser
for help on using the repository browser.