UPI Study › Courses › Introduction to Operating Systems › Free lessons › Lesson 8.1 Free with a free account
The Session Layer
Introduction to Operating Systems · Chapter 8: The Internet, Connectivity, and Network OperationsSection 8.1 · lesson 62 of 838 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Introduction to Operating Systems.
Lesson complete
Earn the 3 college credits for Introduction to Operating Systems
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: The History of the Internet →← The Transport LayerNext lesson: The History of the Internet →
A free account plays all of Chapter 1 and 3 more lessons of Introduction to Operating Systems. Create a free account →
In this lesson
How sessions open, stay alive, close and resume across connections.
- Define a session and place the session layer in the OSI model
- Trace how a web login token opens, carries and closes a session
- Explain keep-alives, timeouts and simplex, half-duplex and full-duplex dialog
- Calculate how many chunks a checkpointed transfer sends after a break
Free study notes
Get this lesson's notes by email
The key points and 4 practice questions with answers, in your inbox. One email, free.
One email. Unsubscribe in one click.
Transcript
Everything said in the video, section by section (1,095 words). Read along, or search it.
Opening Analogy
A Phone Call in Three Parts
A phone call has three parts that you never think about. Someone dials, and the other person answers. That opens the call. You talk, and now and then you ask: are you still there? That keeps it going. At the end, you say goodbye and hang up. That closes it. Computers hold conversations in the same shape. The layer in charge of them is called the session layer. It's the reason a shop site still knows you're logged in, when you click through to the next page.
Definition
A Conversation With Memory
A session is an ongoing conversation between two programs, with a start and an end. During it, they remember things about each other: who you are, what you've already done, and what comes next. In the OSI model from lesson 7.2, the session layer is layer five. It sits just above the transport layer, from lesson 7.6, and just below the presentation layer, from lesson 7.5. Why a separate idea? Because most network protocols forget everything between requests. A web server answers one request, and the next one arrives as if from a stranger. A session adds memory on top, so a conversation can outlast any single message.
Three Phases
Open, Maintain and Close
One honest note. The TCP/IP model has no separate session layer. There, programs at the application layer do this job themselves, with tokens, timers, and library calls. OSI keeps it as a layer, so that the job has a name. Whoever does it, every session goes through the same three phases. Here are three sessions, phase by phase. A web login: a password is checked, and a token is issued. The token rides along with each page. Logout or a timeout deletes it. A video call: ring, answer, and agree on formats. Keep-alive signals flow while it's quiet. Then hang up, and free the line. A large file transfer: agree on the file's name and size. Save checkpoints as data arrives. Then confirm the end, and release the file.
Worked Example
A Login Token Step by Step
Now a web login, step by step. Sam, who runs a small online bakery, logs in to the shop's admin page. The browser sends the user name and the password. A wrong password gets nothing back. A right one makes the server open a session. It makes up a long random token, and remembers that this token belongs to Sam. The token goes back to the browser, which keeps it, usually in a cookie. From then on, the browser attaches the token to every request. Show me the orders, and here's my token. The server looks the token up, and answers: hello Sam, here are your orders. The memory lives in that lookup table.
Closing a Session
Logout and Timeouts Delete the Token
Closing matters as much as opening. When Sam logs out, the server deletes that token from its table. The browser may still hold the old token. But now it means nothing. The same request gets: please log in. Real sites also close a session by timeout, after a quiet spell. Lesson 9.8 covers this and other protections. Banks use short timeouts on purpose. A forgotten open session, on a shared computer, is a risk.
Staying Healthy
Keep-Alives, Timeouts and Dialog Control
Between opening and closing, a session has to stay healthy. The session layer has three jobs here. Keep-alive messages: tiny still-here signals, so that an idle link isn't mistaken for a dead one. Timeouts: a session that's been quiet for too long is closed, to free its resources. And dialog control: deciding who may talk, and when. Talk can go one way only, called simplex, like a TV broadcast. One way at a time, called half-duplex, like a walkie-talkie. Or both ways at once, called full-duplex, like a phone call. A video call uses all of this. Hello signals flow even when nobody speaks, and the call adjusts when the link slows down.
Quick Check
A Ten-Second Wi-Fi Drop
Quick check. Sam is on the orders page, when the Wi-Fi drops for ten seconds. When it comes back, the browser has to open a brand-new TCP connection to the shop server. Then Sam clicks through to the next page. What does the server do? Pause, and decide. It greets Sam by name. The browser sends the same token over the new connection, and that token is still in the server's table. Log in again is the tempting pick. But a session isn't a connection. The session lives in the server's memory and in the token, not in the wire. A new token comes only with a new login. That's why a short Wi-Fi drop doesn't log you out, unless a timeout has already ended the session.
Checkpoints
Resuming From the Last Safe Point
One more session tool: checkpoints. Sam was uploading a four-gigabyte video for a shop ad, when the Wi-Fi dropped near the end. Starting over would waste a long time. A checkpoint is a saved marker: everything up to here arrived safely. The OSI model calls these synchronization points. After a break, both sides resume from the last one. Picture a transfer of ten chunks, with a checkpoint saved after every third chunk. The link dies after chunk seven. The last checkpoint was at chunk six, so only chunks seven to ten are sent again. That's seven chunks before the break, plus four after: eleven in all. Starting from zero would have sent seventeen. More frequent checkpoints waste less on a break, but each one costs a little work to save. Sam's upload tool kept markers like these. After reconnecting, it picked up from the last one, and finished in a minute.
Quick Check
Counting Chunks After a Break
Quick check. Ivy, who looks after the computers at a school, copies a twelve-chunk backup to a server. A checkpoint is saved after every fourth chunk. The link breaks right after chunk ten. Counting both tries, how many chunks are sent in all? Pause, and predict. Fourteen. The checkpoints fall after chunks four and eight, so the last safe point before the break is eight. Chunks nine to twelve go again. That's four more, on top of the ten already sent. Twelve is tempting, but it resumes right after chunk ten, and nothing marked ten as safe. Twenty-two would mean starting from zero.
Key Takeaways
Sessions Outlive Connections
To recap. A session is a conversation with memory: opened, maintained, and closed. On the web, a token carries the session. Logout or a timeout deletes it on the server. Keep-alives, timeouts, and dialog control keep a session healthy, and it outlives a dropped connection. Checkpoints let a broken transfer resume from the last safe point.
Think About It
Short Timeouts Versus Long Ones
Something to think about. Your bank logs you out after a few quiet minutes, but a video site keeps you logged in for weeks. Why might each one choose its timeout that way?
About Introduction to Operating Systems at UPI Study
Introduction to Operating Systems (Computer Science 354) is a self-paced online course of 83 video lessons in 10 chapters, from what an operating system does and process scheduling to concurrency, memory, devices, file systems, networks, the internet, security and virtual machines. It carries a NCCRS credit recommendation for 3 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Compare: Linux vs Operating Systems
Why take it here
Why students take Introduction to Operating Systems with UPI Study
Where the credit goes
Universities that work with NCCRS
Introduction to Operating Systems carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About The Session Layer
What is the difference between a session and a connection?
How does a session token keep a user logged in?
What is the difference between simplex, half-duplex and full-duplex?
How do checkpoints help resume a file transfer?
About the Introduction to Operating Systems course
How many college credits is Introduction to Operating Systems?
How much does Introduction to Operating Systems cost and what is included?
Which universities accept UPI Study credits?
How long does Introduction to Operating Systems take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in Introduction to Operating Systems.
83 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
Updated
3 credits · NCCRSEnroll →