Abstract:When the computer is handling multi-file tasks, it may read and write a file at the same time, resulting in the failure of the file data to be fully read and written or in the loss of some data. In the Linux kernel, with the single processor, task allocation and processing is made with the synchronization mechanism. The classic approach is atomic operations, semaphore mechanisms, mutexes, etc. In the multi-processor systems, the test-and-set primitive operation is made to solve the problem. In this paper, we design a new task scheduling scheme for multitasking to avoid mutual exclusion access. We use a Matlab program to realize the algorithm, and the result shows that the algorithm can effectively realize the multi-file tasks parallel execution.