What's write()'s true impl. logic?

The Linux kernel caches read/write access to disk in order to improve performance. The code sample below shows an example of this.

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

int
main()
{
    int fd = open("./test.txt", O_RDWR, 0766);
    if (fd < 0) {
        printf("open file failed %d\n", errno);
        return -1;
    }
    
    char msg[100] = "write this msg to disk";
    write(fd, msg, strlen(msg));

    return 0;
}

I would like to know: is the copying of the msg to the buffer a time-consuming operation?

No, copying the msg to the buffer is not a time-consuming operation.