I/O and Syscalls in Critical Sections and their Implications for Transactional Memory
Lee Baugh and Craig Zilles University of Illinois at Urbana-Champaign
I/O and Syscalls in Critical Sections and their Implications for - - PowerPoint PPT Presentation
I/O and Syscalls in Critical Sections and their Implications for Transactional Memory Lee Baugh and Craig Zilles University of Illinois at Urbana-Champaign Side-Effects in Transactions begin_transaction(); myarr[x]= fgetc(myfile);
Lee Baugh and Craig Zilles University of Illinois at Urbana-Champaign
mechanisms handling side-effects in transactions?
begin_transaction(); myarr[x]= fgetc(myfile); end_transaction();
transactional workloads
sections are representative of transactions
two large, multithreaded applications: Firefox and MySQL
+ clean semantics
+ Very simple and transparent, permits dependences
+ Permits explicit aborts, doesn’t serialize, permits dependences
kernel and the single X11 thread
sharing
pthread_mutex acquires and releases
Frequency in Critsecs Category of Syscall Syscalls Seen in Critical Sections MySQL Firefox Time gettimeofday, clock gettime 3.91% 70.18% Filesystem read*, write*, open, close, lseek, access, dup, mkdir, ftruncate, fsync, writev, pread*, pwrite*, stat, fstat, fcntl, getdents, getcwd, fdatasync, mmap*, munmap*, mprotect* 53.79% 28.75% Process Memory brk, mmap*, munmap*, mprotect* 31.03% 0.32% Process Maintenance waitpid, clone, sched setscheduler, sched get priority max, sched get priority min, rt sigaction, rt sigprocmask, tgkill 8.97% 0.32% Communication ioctl, socket, pipe, read*, write*, pread*, pwrite* 2.07% 0.40% System Info sysinfo, uname 0.23% 0.03%
representing what protection they require at the scope of the call:
e.g. ‘lseek’
‘going nonspeculative’ or compensation -- e.g. an ‘open’ call creating a file may compensate with ‘unlink’
call -- e.g. ‘tgkill’, ‘socket’. Programmers may compensate at higher levels
➡ Syscalls deferred for more time; transactions going nonspeculative -- that is, serializing -- for longer
(a) Distribution of TCS Durations in Firefox 1E+0 1E+1 1E+2 1E+3 1E+4 1E+5 1E+6 1E+0 1E+1 1E+2 1E+3 1E+4 1E+5 1E+6 1E+7 Duration of TCSs (µs) Number of TCSs
Critical Sections without syscalls Critical Sections with syscalls (syscalling-TCSs)
(b) Distribution of TCS Durations in MySQL 1E+0 1E+1 1E+2 1E+3 1E+4 1E+5 1E+6 1E+7 1E+0 1E+1 1E+2 1E+3 1E+4 1E+5 1E+6 1E+7 Duration of TCSs (µs) Number of TCSs
Critical Sections without syscalls Critical Sections with syscalls (syscalling-TCSs)
(a) Distribution of Syscalls in syscalling-TCSs in Firefox 700 1400 2100 2800 0% 20% 40% 60% 80% Progress Through syscalling-TCSs in Firefox Syscalls 0% 25% 50% 75% 100% Cumulative Syscalls (b) Distribution of Syscalls in syscalling-TCSs in MySQL 20 40 60 80 0% 20% 40% 60% 80% Progress Through syscalling-TCSs in MySQL Syscalls 0% 25% 50% 75% 100% Cumulative Syscalls
syscalls
(a) Distribution of First Syscalls in syscalling-TCSs in Firefox 350 700 1050 1400 0% 20% 40% 60% 80% Progress Through syscalling-TCSs in Firefox First Syscalls 0% 25% 50% 75% 100% Cumulative Syscalls (b) Distribution of First Syscalls in syscalling-TCSs in MySQL 18 36 54 72 0% 20% 40% 60% 80% Progress Through syscalling-TCSs in MySQL First Syscalls 0% 25% 50% 75% 100% Cumulative Syscalls
consumed the result of their first syscall ➡ Deferral is not a general solution
which retire between x’s first syscall and its release
which would like to retire but cannot
(a) Syscalling-TCS Overlap in Firefox 0% 25% 50% 75% 100% 1 10 100 1000 10000 100000 1000000 # TCSs Overlapped Syscalling-TCSs (b) Syscalling-TCS Overlap in MySQL 0% 25% 50% 75% 100% 1 10 100 1000 # TCSs Overlapped Syscalling-TCSs
Syscalling TCSs All TCSs
won’t be trivial
code and a transactional filesystem, nearly all of the observed side effects can be handled speculatively, by protecting them at the library level
performance, and could be a good choice if explicit aborts are not required