Questions on the SI language - page 8

 
 
Igor Makanu:

there are memory areas and there are pointers to memory areas stored in other memory areas

and then there's a hierarchy as long as the brain can perceive

 
Vladimir Simakov:
Moreover, assembler inserts are very much used too.

I partially take it back, watch from 18:00 , yes, they do not write in asm, but fix already compiled code - then it is logical

as far as I understand what modern compilers with assembler inserts do is just an imitation of asm, i.e. it is not certain that asm insertion in such form will get into the compiled code, and to really optimize in asm code enough to rewrite code sections in asm in debugger - imho


 
Maxim Dmitrievsky:

there are memory areas and there are pointers to memory areas stored in other memory areas

and then there's a hierarchy as long as the brain can perceive

Yeah, and it's also cool not to keep track of whether a link is alive or not and crawl into a long released memory section that is already used by another process and break everything there))))

 
Vladimir Simakov:

Yeah, and it's also cool not to track when a link is alive or not and crawl into a long released memory space, which is already used by another process and break everything there))))

What a fairy tale, this was only possible in Windows 3.*. Windows will not let you into someone else's process memory, every process works in its own area, and for it the memory addressing starts from zero, that's how it is presented to it by Windows. And in general, Windows allocates memory only when really writing data. Make an array double arr[1024*1024*1024] and see how much memory is actually allocated in Task Manager. But not at all! Until you actually start writing to the array, memory will not be allocated in 4Kb chunks. Even if you write it using randomized indices, it will still be in such chunks. How Windows virtualizes all this is unfathomable to me!

 
Alexey Volchanskiy:

How Windows virtualises all this is unfathomable to me!

I don't want to google it, but with the advent of the Pentium-1 the processor has memory segment descriptors and virtual memory, i.e. most likely it is hardware-level virtualisation, and Windows uses it skillfully

 
Alexey Volchanskiy:

What a fairy tale, this was only possible in Windows 3.*. Windows will not let you into someone else's process memory, every process works in its own area, and for it the memory addressing starts from zero, that's how it is presented to it by Windows. And in general, Windows allocates memory only when really writing data. Make an array double arr[1024*1024*1024] and see how much memory is actually allocated in Task Manager. But not at all! Until you actually start writing to the array, memory will not be allocated in 4Kb chunks. Even if you write it using randomized indices, it will still be in such chunks. How Windows virtualizes all this is unfathomable to me!

Page Fault. The exception was a whammy - they gave memory per page, nothing more. This is convenient and transparent for applications but it leads to memory fragmentation. You can allocate physical memory in one fell swoop if you call virtuallock on the resulting pointer after virtualalloc. By the way, it's an interesting hole, I'll have to see if it's possible to crash the server that way.


Three didn't have virtualization, it's a different system, not NT. There were a lot of DOS tails in there, half of the system functions were hinged on int 21.

 

This case is not clear:

/*
 * The mine_score structure describes the maximum normalized mutual information
 * scores (i.e. the characteristic matrix if est=EST_MIC_APPROX, the
 * equicharacteristic matrix instead). M[i][j] contains the score using a grid
 * partitioning x-values into i+2 bins and y-values into j+2 bins. m and M are
 * of length n and each M[i] is of length m[i].
 */
typedef struct mine_score
{
  int n;      /* number of rows of M */
  int *m;     /* number of cols of M[i] for each i */
  double **M; /* the (equi)characteristic matrix */
} mine_score;

Further, in the f-i there is a change in the size of the matrix M:

/*
* Returns an initialized mine_score structure. Returns NULL if an error
* occurs.
*/
mine_score *init_score(mine_problem *prob, mine_parameter *param) {   int i, j;   double B;   mine_score *score;   if ((param->alpha > 0.0) && (param->alpha <= 1.0))     B = MAX(pow(prob->n, param->alpha), 4);   else if (param->alpha >= 4)     B = MIN(param->alpha, prob->n);   else     goto error_score;   score = (mine_score *) malloc (sizeof(mine_score));   if (score == NULL)     goto error_score;   score->n = MAX((int) floor(B/2.0), 2) - 1; задали кол-во строк, ок   score->m = (int *) malloc(score->n * sizeof(int)); а кол-во столбцов тут чему равно? кол-ву строк?   if (score->m == NULL)     goto error_score_m;   for (i=0; i<score->n; i++)     score->m[i] = (int) floor((double) B / (double) (i+2)) - 1;   score->M = (double **) malloc (score->n * sizeof(double *));   if (score->M == NULL)     goto error_score_M;   for (i=0; i<score->n; i++)     {       score->M[i] = (double *) malloc ((score->m[i]) * sizeof(double)); а здесь идет просто выделение памяти для матриы М?       if (score->M[i] == NULL)         {           for (j=0; j<i; j++)             free(score->M[j]);           goto error_score_M_i;         }     }   return score;   error_score_M_i:     free(score->M);   error_score_M:     free(score->m);   error_score_m:     free(score);   error_score:     return NULL; }

That is, as I understand it, all this mess is only for allocating memory for the matrix, but it is not filled with any values? So, this code can be thrown out for mql (well, after determining the number of rows and the same number of columns of the square matrix)

or the matrix is initialized with some values

 
Alexey Volchanskiy:

...How the wind system virtualises all this is unfathomable to me!

Read Richter. He's got it all chewed up to the point of hurting your heart.

SeriousRacoon:
By the way, interesting hole, I'll have to see if it's possible to crash the server that way

You can't.

 
Maxim Dmitrievsky:

This case is not clear:

typedef struct mine_score
{
  int n;      /* number of rows of M */
  int *m;     /* number of cols of M[i] for each i */
  double **M; /* the (equi)characteristic matrix */
} mine_score;
  score->n = MAX((int) floor(B/2.0), 2) - 1; задали кол-во строк, ок
  score->m = (int *) malloc(score->n * sizeof(int)); а кол-во столбцов тут чему равно? кол-ву строк?
score->M[i] = (double *) malloc ((score->m[i]) * sizeof(double)); а здесь идет просто выделение памяти для матриы М?

Further, in the f-i there is a change in the size of the matrix M:

That is, as I understand it, all this mess is only for allocating memory for the matrix, but it is not filled with any values? So, this code can be thrown out for mql (well, after determining the number of rows and the same number of columns of the square matrix)

or, after all, the matrix is initialized with some values

Inmine_score*m is a pointer to int, and the comment says it's an array, so each row has a different number of columns, it's called a "comb array" not rectangular.

score->m = (int *) malloc(score->n * sizeof(int))

It simply allocates memory for this array of row lengths, no values

For the matrix M itself.

score->M = (double **) malloc (score->n * sizeof(double *));

here is allocated memory for pointers of rows

score->M[i] = (double *) malloc ((score->m[i]) * sizeof(double)); а здесь идет просто выделение памяти для матриы М?

and here for columns

Reason: