What is the relationship between system calls and CPU time slices, and is there atomicity?

when I read a book, I learned that write system calls can be considered atomic. So I was a little curious:

  1. if a process calls write at the end of its time slice, the write call is not completed by the time the process should have been switched. So what happens? Will the kernel automatically extend its time slice until the call is complete, or will it still switch to another process according to the established time slice plan, leaving the original process in write ?
  2. if two different processes simultaneously call write to write the same file (the system is multicore, so it is really "simultaneous"). For example, if you write "1111" and "2222" respectively, is it possible to have "11221122" under certain circumstances? (you won"t be confused after a personal attempt, but I wonder if there is any special situation in which this disorder can occur.)
Jun.22,2021

do you know what atomicity means? Can it be called atomicity if it is deranged?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35b4c-2bfcb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35b4c-2bfcb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?