U.S. stocks switched between gains and losses on Friday, as investors continue to adjust to an economic environment marked by the possibility of both higher inflation and rising borrowing costs.

The S&P 500 index and Dow industrials were on track for their largest weekly drops since November 2008, when the markets reeled in the wake of the financial crisis.

What are the main benchmarks doing?

The Dow Jones Industrial Average went from deep losses to trade modestly higher, up 110 points, or 0.4%, to 23,971.

The S&P 500 was up 15 points, or 0.5%, to 2,543, with eight of the 11 main sectors trading in the green. Energy shares were leading the losses, down about 1% after oil prices plunged 5%.

The Nasdaq Composite Index was up 45 points, or 0.7%, to 6,824.

All three main indexes are down about 10% from their all-time highs, set two weeks ago.

According to financial blog SentimenTrader, Thursday's drop marked the Dow's fourth-fastest decline into correction territory from an all-time high, based on data that goes back to 1897.

Based on Thursday's close, 96 of the S&P 500's components are in bear market territory (http://www.marketwatch.com/story/more-than-10-of-sp-500-stocks-are-in-a-bear-market-2018-02-08), defined as a 20% drop from a peak. Only 88 of the components aren't in correction territory.

(https://twitter.com/RyanVlastelica/status/961708128927657984)

The Cboe Volatility Index rose 5.7% to 35.54. The so-called "fear index" has more tripled so far this year; the S&P has undergone six sessions with a 1% move in 2018 (through Thursday's close), nearly equaling the number of such moves seen over the entirety of 2017.

Don't miss:Jim Cramer blames a 'group of complete morons' for blowing up the market (http://www.marketwatch.com/story/jim-cramer-blames-a-group-of-complete-morons-for-blowing-up-the-market-2018-02-08)

What's driving markets?

Driven by volatility worries and inflation concerns, stocks are facing their worst weekly performances in years, with all the main indexes down more than 8% over the week. It is the biggest weekly percentage decline for both the Dow and the S&P since late 2008 and the biggest for the Nasdaq since August 2011.

The Dow has suffered a pair of 1,000-point drops this week, including in Thursday's session. That decline, which accelerated throughout afternoon trading, sparked global selling on Friday. Meanwhile, Europe was broadly lower as was Asia. Chinese stocks bore the brunt of the blow, dropping as much as 6% at one point.

President Donald Trump's signing of legislation to end a brief government shutdown after the House and Senate approved a budget deal (http://www.marketwatch.com/story/senate-passes-budget-deal-as-government-remains-shut-down-2018-02-09) did little to lift the markets.

"Right now markets are moving more on the emotions of trading, rather than economic fundamentals. Once the fears get rolling, it's purely sentiment and what traders can imagine in terms of where things can be going that drive price action," said Bruce McCain, chief investment strategist at Key Private Bank.

"We could have fallen enough to account for the new inflation fears, but we need to form a pretty stable base before investors can feel reassured the bottom won't fall out from under them, and it will take some more price action before that occurs."

Cboe Global Markets Inc.(CBOE) shares were down 6.4% as investors continue to shun the stock in the fallout over futures on the Cboe Volatility Index. The stock is down more than 20% over the week.

FireEye Inc. (FEYE) shares surged 11% after the software-security company revealed its first quarterly profit (http://www.marketwatch.com/story/fireeye-earnings-show-first-quarterly-profit-stock-jumps-more-than-12-2018-02-08). Nvdia Corp.(NVDA) was up 2% after upbeat earnings ().

Shares of Mattel Inc.(MAT) rose 3.2% after the toy maker appointed a new chairman.

What are other assets doing?

European stocks (http://www.marketwatch.com/story/european-stocks-head-lower-after-wall-street-fails-to-rebound-2018-02-08) were headed for the worst week in two years (http://www.marketwatch.com/story/european-stocks-head-for-worst-week-in-2-years-as-global-selloff-rages-on-2018-02-09), while Wall Street's late plunge hit Asia markets hard (http://www.marketwatch.com/story/asian-markets-skid-after-wall-street-sinks-into-correction-territory-2018-02-08), with several indexes posting their worst week in years. The Shanghai Composite Index closed down 4%, after losing as much as 6% in the session, while the Nikkei 225 index dropped 2.3%.

After trading above 2.80% all of Thursday's session, the yield on 10-year Treasury notes slid 3 basis points to 2.79%.

Gold futures were modestly higher, while crude-oil futures dropped nearly 5%. The ICE U.S. Dollar Index moved up 0.3% to 90.477.