As each of the 157 members of the Nashoba Valley Technical High School Class of 2016 accepted his or her diploma, each completed a type of marathon. Instead of 26.2 miles, it was four years of studying for tests in academics while striving to get a leg up on their counterparts by mastering a technical program and opening a career pathway.

David McGillivray, the guest speaker at the commencement ceremony on Saturday, June 4, could commiserate.

McGillivray is race director of the Boston Marathon and a distance runner who has run across the country — 3,452 miles — to raise money for the Jimmy Fund, then did it again in 2004 with other runners, and has run every Boston Marathon since 1973.

“Life is a marathon not a sprint — OK, you knew that was coming,” he deadpanned to the crowd’s laughter.

“But you’re at the starting line of the marathon,” he told the graduates. “Pace yourself and be patient. You have a long way to go, and you’ll probably experience hills and turns along the way.

“Nobody knows what lies ahead. That’s the beauty of it. That’s the adventure of it,” he added. “The whole of our lives, from the moment we’re born till the moment we die, is a process of learning.”

Near the end of his entertaining talk, McGillivray told the students not to listen to the naysayers, because he never did. He told them when people ask what he does for work, he says, “I don’t. Because I love what I do so much, I don’t consider it work.”

“Those who say it cannot be done should not interfere with those who are doing it,” he said. “Find something you love and do it, and you’ll never work a day in your life.”

Salutatorian Chloe Adler-Mandile, who earned her technical certificate in Engineering Technology and will attend Worcester Polytechnic Institute in the fall, continued the theme of overcoming

“It doesn’t make a difference if you were in Carpentry or Cosmetology, Graphic Design or Engineering — every single one of us has faced obstacles,” Chloe said. “Whether it was a difficult team to face at a track meet, a math test that just didn’t make sense, a shop project that just wasn’t coming together as planned, or an argument with your best friend. It wasn’t the obstacles that defined us — it was the way we reacted to them.

“Tough meet? You trained harder. Bad test? You studied longer.

Difficult project? You worked together. Fight with a friend? You listened to each other. And with every obstacle you overcame, you grew stronger. We put in hard work and we learned from our failures. And now, we have the medals, the grades, the projects and the relationships to prove it.”

No one has to tell Alicia Gentile about overcoming obstacles. The Groton resident graduated twice this spring. In May, she received an Associate degree from Middlesex Community College, which she attended full time the last two years of high school through Nashoba Tech’s Dual Enrollment program, and was chosen to be a student speaker at the college’s commencement ceremony.

Nine days later, she was speaking as valedictorian at her high-school graduation.

So when she talked about her fellow graduates leaving their “comfort zone,” she knew of which she spoke.

“The best opportunities come to those who seek them, not those who sit and wait,” she said. “So take a chance, and if you find yourself scared or nervous — good. That’s how you know you’re making a good decision. Don’t be afraid to make decisions for yourself to better your own future. Strive to be your own person regardless of any doubt you may encounter.”

Alicia will attend the University of San Francisco in the fall in hopes of becoming a pediatric oncologist. Before diplomas were given out by School Committee Chairman Al Buckley of Pepperell and Superintendent Denise Pigeon, presiding over her first graduation, Sabrina Reedy of Chelmsford, the class president, left her fellow graduates with this advice: “We are all anticipating our next move and what we will do with our fresh start. What we should be doing is enjoying this moment, for it is a day we will look back on for a lifetime.”