const { parentPort, workerData } = require('worker_threads'); function multiplyMatricesPart(A, B, start, end) { const n = A.length; const C = Array.from({ length: n }, () => Array(n).fill(0)); for (let i = start; i < end; ++i) { for (let j = 0; j < n; ++j) { for (let k = 0; k < n; ++k) { C[i][j] += A[i][k] * B[k][j]; } } } return C; } const { A, B, start, end } = workerData; const result = multiplyMatricesPart(A, B, start, end); parentPort.postMessage(result);